Practical – 116.1 : Embded javascript in HTML
Program Code :
<!DOCTYPE html>
<html>
<head>
 <title>ITI JavaScript Program</title>
 <style>
   body {
     font-family: Arial, sans-serif;
     background-color: #e9f5ff;
     text-align: center;
     padding: 50px;
   }
   input, button {
     padding: 10px;
     font-size: 16px;
     margin: 10px;
   }
   #message {
     color: green;
     font-weight: bold;
     margin-top: 20px;
   }
 </style>
</head>
<body>
 <h1>Welcome to ITI JavaScript Demo</h1>
 <p>Enter your name:</p>
 <input type=”text” id=”nameInput” placeholder=”Enter your name” />
 <button onclick=”showMessage()”>Submit</button>
 <p id=”message”></p>
 <script>
   function showMessage() {
     var name = document.getElementById(“nameInput”).value;
     if (name.trim() !== “”) {
       document.getElementById(“message”).innerHTML = “Hello, ” + name + “! Welcome to ITI.”;
     } else {
       document.getElementById(“message”).innerHTML = “Please enter your name.”;
     }
   }
 </script>
</body>
</html>