To include client side script in HTML documents,
HTML Script Tag
Using HTML script tag client side scripts can be included. Script can be included in two ways, either the script code itself can be enclosed within the
<script> tag in the HTML page itself or using
src attribute an external script file can be included.
Very common use case for including script in client side is form validation and dynamic change in display elements. Following is an example.
<!DOCTYPE html> <html> <head> <title>HTML Meta Tag Example</title>
<body> <p>Click button to say hello!</p> <input type="button" onclick="helloScript();" name="hello" value="hello" /> </body>
Click button to say hello!
In the above example, we have included script code in HTML head within the
<script> tag. Then we have also included an external file using
HTML noscript Tag
document.getElementById("hello").innerHTML = "Hello World!";
document.getElementById("hello").style.fontSize = "12px";