Scripts in both the Head and the Body Section
You can place an unlimited number of scripts in your document, so you can have scripts in both the body and the head section. |
|
.js
file extension.
Note that the external script cannot contain the <script>
tag!
To use the external script, point to the .js
file in the src
attribute of the <script>
tag.
Remember to place the script exactly where you normally would write the script!
<html> <body> <script src="e_2.js" /> </body> </html> |
var name = prompt( "Please enter your name:" ); if (( name != null ) && ( name != "" )) { document.write( "Good morning, "+name ); } |