Professional Documents
Culture Documents
The Tag
The Tag
The Tag
<html>
<head>
<script type=“text/javascript”>
//script statements
</script>
</head>
Location of Code
2. In the <body> element
– Place scripts to be executed when the page
loads here
– Script generates some or all of the contents
of the page
<body>
<script type=“text/javascript”>
//script statements
</script>
</body>
Location of Code
3. External to the HTML file
<head>
<script src=“myfile.js”>
</script>
</head>
alert(x); alert(x)