Friday, April 12, 2024

Javascript-Lesson2 - Functions

 <!DOCTYPE HTML>

<html>

<head>

 <title> Functions</title>

</head>

<body bgcolor="aqua">

   <h1>Functions in Javascript</h1>


   <script>

      //document.write("Welcome to programming world of javascript");

      function hello(){

         //document.write("Welcome to programming world of javascript");

         alert("Welcome to programming world of javascript");


      }

      //hello();

   </script>

      <!--create button call above hello() function in onclick -->

      <input type="button" value="Click Here" onclick="hello()" />

</body>

</html>

Javascript-Lesson1- Different ways to dispaly content on webpage

 <!DOCTYPE HTML>

<html>

<head>

 <title> Different ways to dispaly content on webpage 3 ways to display content 1. document.write(Testing Purpose) 2. window.alert (Alert Box) 3. innerHTML (Form Validations)</title>


</head>

<body>

   <p id = "demo"> paragraph</p>

    <script type= "text/javascript"> 

      document.getElementById("demo").innerHTML = "Hi Narendra innerHTML message display"; // form validations it is very useful

     //window.alert("Narendra first alert js"); // it will show alert popup/window

     //alert("Narendra first alert js"); // it will show alert popup/window

     //document.write("Narendra first js"); //testing purpose to display the data


    </script>

</body>

</html>