HTML script tag
HTML <script> tag adds the script in the html document. Script can be added directly in between the elements (inline) or imported from an external source using src attribute.
<p>script element is used to add javascript in a page. For example, we make a function of cube in javascript.</p>
<script>
var x=5;
function product(x){
document.write(x*x*x);
}
product(5);
</script>
</>
script element is used to add javascript in a page. For example, we make a function of cube in javascript.
Tag Uses
Specific uses of <script> tagIt makes the content dynamic.
Tag omission
Both opening and closing tags are necessary for the script element.
Global Attributes
All the global attributes are applicable on the script element.
Tip: The script should be placed at the end of a page.
Next Previous
Was this article helpful?