Scripting Tags

Next ❯Image Tags

It is used to add javascript codes to the html pages to perform some functionality inside your web page

  • Tags are: <script>, <noscript>
  • Below are the basic examples of JavaScript using Scripting Tag
Tag:
  • label_outline<script> Tag
    • This is also called "Internal JavaScript"
    <!DOCTYPE html>
    <html>
    <head><title>Script Tag Example</title>
     <script type="text/javascript">
      function myFun() {
       alert('This is a alert message');
      }
     </script>
    </head>
    <body>
     <button onclick="myFun();">click on me</button>    
    </body>
    </html> 

    Output:

  • label_outlineAnother Way to use <script> Tag
    • This is also called "External JavaScript"
    <!DOCTYPE html>
    <html>
    <head><title>Script Tag Example</title>
      <script src="myjavaFile.js"></script>
    </head>
    <body>
     <button onclick="alertFun();">Click On Me</button>    
    </body>
    </html>

    "myjavaFile.js" file contains

    function alertFun() {
      alert('This is a External function alert message');
    }

    Output:

    • you can create your java file externally and call it on your web page
  • label_outline<noscript> Tag
    <!DOCTYPE html>
    <html>
    <head><title>NoScript Tag Example</title>
     <script type="text/javascript">
      function myFun() {
       alert('This is a alert message');
      }
     </script>
    <noscript>Your browser does not support JavaScript! </noscript>
    </head>
    <body>
     <button onclick="myFun();">click</button>    
    </body>
    </html> 

    Output:

    • Above, we are using Developer tools to show you how this tag actually works
    • When JavaScript disabled on your browser then <noscript> codes executes on your page
    • well, you will learn JavaScript in new separate tutorial
Browsers Supports
SafariMicrosoft EdgeMozilla FirefoxChromeOpera Mini

Click on the above icon to see the name of the browser !

  • Tips! Always try to use latest version of browser

  • Image Tags
❮ Prev Table Tags
Next ❯Image Tags
TryOut Examples"Learn to Explore..!"

TryOut Editor

receipt