lunes, 8 de septiembre de 2014

3.4.4 - Ejercicio 2

Ejercicio 2

Modificar el primer script para que:

  1. El mensaje que se muestra al usuario se almacene en una variable llamada mensaje y el funcionamiento del script sea el mismo.
  2. El mensaje mostrado sea el de la siguiente imagen:


Solución:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ejercicio 2 - Mostrar mensajes complejos</title>
 
<script type="text/javascript">
  var mensaje = "Hola Mundo! \n Qué facil es incluir \'comillas simples\' \n y \"comillas dobles\" ";
  alert(mensaje);
</script>
</head>
 
<body>
<p>Esta página muestra un mensaje complejo</p>
</body>
</html>

No hay comentarios.:

Publicar un comentario