HTML script tag

  • <script> tag is a HTML tag that allows us to add and define scripts to our HTML file.
  • Within this tag, we can write JavaScript as well as create an external js file and define it within script tag.
  • In HTML4, we needed to define type characteristic while using script tag; but with HTML5, this is no longer a necessity.
HTML 4
<script type="text/javascript">
    Javascript Code
</script>
HTML5
<script>
    Javascript Code
</script>

HTML script tag

<script>
  alert("Hello World");
</script> 

In the example below, an externally created custom.js file is introduced to the html file using the script tag.

367 Views
48420cookie-checkHTML script tag

Leave a Reply

Your email address will not be published. Required fields are marked *