• 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,

<!DOCTYPE html>
<html>

<head>
<title>Welcome to Kaashiv</title>
<script src = "/html/script.js" type = "text/javascript"/></script>
</head>

<body>
<input type = "button" onclick = "Hello();" name = "ok" value = "Click Me" />
</body>
</html>

Output:

Categorized in: