- It is a small piece of javascript program that can add user interactivity to your website.
- A Script could provide a dropdown menu and generate a pop-up alert box message.
- It can trigger those functions using HTML attributes and write various small functions, called event handlers using any of the scripting language.
- Nowadays most of the web developers using JavaScript and associated framework.
- In separate file we can keep JavaScript code and then include it wherever it’s needed, or you can define functionality inside HTML document itself.
For example,
[pastacode lang=”markup” manual=”%3C!DOCTYPE%20html%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chtml%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chead%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ctitle%3EWelcome%20to%20Kaashiv%3C%2Ftitle%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cscript%20src%20%3D%20%22%2Fhtml%2Fscript.js%22%20type%20%3D%20%22text%2Fjavascript%22%2F%3E%3C%2Fscript%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fhead%3E%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cbody%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cinput%20type%20%3D%20%22button%22%20onclick%20%3D%20%22Hello()%3B%22%20name%20%3D%20%22ok%22%20value%20%3D%20%22Click%20Me%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fbody%3E%0A%20%20%20%20%20%20%20%20%20%20%3C%2Fhtml%3E%0A” message=”” highlight=”” provider=”manual”/]Output:

