samedi 31 janvier 2015

Why use script type multiple times


With the following working code I had a question about some of the needed syntax. Why do you need to set the script type in multiple places in the html code instead of just once in order to get it to work? Shouldn't there be a way to only set it once and then have the rest of the code be able to read your script?



<html>
<head>
<title>Assignment 2</title>
<script type="text/javascript">

var name1 = prompt("What is your name?");
var name2 = prompt("What is the second person's name?");

function Greet(who1, who2)
{
alert("Hello " + who1 + " and " + who2 + ". Welcome to my website.");
}

</script>
</head>
<body>
<h1>JavaScript Greet Function<h1>
<script LANGUAGE="JavaScript">
Greet(name1,name2);

</script>
</body>
</html>




Aucun commentaire:

Enregistrer un commentaire