Where to Put JavaScript in HTML

best place to include script in html layout

Example 1:

JavaScript in <head> or <body>
You can place any number of scripts in an HTML code document. Scripts code can be placed in the <body> , or in the <head> part of an HTML web page, or in both.

calling javascript file in html

<script type="text/javascript" src="add_members.js"></script>

how to enter javascript in html

Example 3:

<script type="text/javascript">
alert("This alert box was called with the onload event");
</script>

where is the correct place to insert a javascript

You can place any Java script source code in the <body>, or in the <head> part.

I hope you get an idea about where is the correct place to insert a javascript head or body?.


#javascript 

Where to Put JavaScript in HTML
1.00 GEEK