Para utilizar javascript utilizamos la etiqueta <script> </script> que puede ir despues de la etiqueta <head> </head> o puede ir dentro de la etiqueta <body> </body>.
Cuando necesitemos incorporar código html dentro de un javascript se utiliza document.write
El docente nos dejo un ejercicio el cual fue:
<html>
<head>
<title></title>
</head>
<script>
alert("Hola muy buenos dias");
document.write ("<hr>");
document.write ("<center>Juan Pablo</center>");
document.write ("<hr>");
document.write ("<center><font color='red'>14</font></center>");
document.write ("<hr>");
document.write ("<marquee behavior='alternate' width='60%'>Colegio Integrado Nuestra Señora Del Divino Amor</marquee>");
</script>
<body>
</body>
</html>
<head>
<title></title>
</head>
<script>
alert("Hola muy buenos dias");
document.write ("<hr>");
document.write ("<center>Juan Pablo</center>");
document.write ("<hr>");
document.write ("<center><font color='red'>14</font></center>");
document.write ("<hr>");
document.write ("<marquee behavior='alternate' width='60%'>Colegio Integrado Nuestra Señora Del Divino Amor</marquee>");
</script>
<body>
</body>
</html>
Ese es el código del ejercicio y se vería de la siguiente manera
No hay comentarios.:
Publicar un comentario