Javascript - Dialog Boxes

<html>
   <head> 
      <script type = "text/javascript">
         <!--
            function Warn() {
               alert ("This is a warning message!");
               document.write ("This is a warning message!");
            }
         //-->
      </script>   
   </head>
 
   <body>
      <p>Click the following button to see the result: </p>     
      <form>
         <input type = "button" value = "Click Me" onclick = "Warn();" />
      </form>   
   </body>
</html>


<html>
   <head> 
      <script type = "text/javascript">
         <!--
            function getConfirmation() {
               var retVal = confirm("Do you want to continue ?");
               if( retVal == true ) {
                  document.write ("User wants to continue!");
                  return true;
               } else {
                  document.write ("User does not want to continue!");
                  return false;
               }
            }
         //-->
      </script>   
   </head>
 
   <body>
      <p>Click the following button to see the result: </p>     
      <form>
         <input type = "button" value = "Click Me" onclick = "getConfirmation();" />
      </form>     
   </body>
</html>

<html>
   <head>   
      <script type = "text/javascript">
         <!--
            function getValue() {
               var retVal = prompt("Enter your name : ", "your name here");
               document.write("You have entered : " + retVal);
            }
         //-->
      </script>     
   </head>
 
   <body>
      <p>Click the following button to see the result: </p>     
      <form>
         <input type = "button" value = "Click Me" onclick = "getValue();" />
      </form>     
   </body>
</html>

No comments:

Post a Comment

Welcome

Lets learn java script