JavaScript Tags
The html script tag wants the browser to get a script between them. We can expect the scripts to be in the following places.
1.The script can be placed in html's head tag
2.Within Html's body tag.
3.As an external file.
Most importantly client side scripts such as JavaScript are placed in script tags.
demonstration code
<html> <body> <p>This example writes "JavaScript is not java" into an HTML element with id="script"</p> <p id="imp"></p> <script> document.getElementById("imp").innerHTML = "JavaScript is not java"; </script> </body> </html>
Output
This example writes "JavaScript is not java" into an HTML element with id="script" JavaScript is not java
Explanation
Every JavaScript code should be in the script tag, if not the code wont execute.In the above example using attribute id the code has executed as "JavaScript is not java".