Way of adding JavaScript:
Inline–
- Inside head Tag
- Inside body Tag
Inside Head Tag
Inside Body Tag
External file
- Inside head Tag
- Inside body Tag
Inside head Tag
Inside body Tag
- <script> – Opening Script Tag.
- src – It‟s an attribute of script tag. It defines source/location of script file.
• dev.js – This is our script file. Where dev is file name and .js is the extension
of javascript file.
• type – It‟s an attribute of script tag which tells the browser it is a javascript.
This is optional now a days.
• text/javascript – Its type of document
• document.write(“Hello World”); – This is a function to display data.
• </script> Closing Script tag
Latest posts by rajeshkumar (see all)