Advertisement
FahimFaisal

Javascript_form1

Oct 11th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.59 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>JD-form2</title>
  6. </head>
  7.  
  8. <script type="text/javascript">
  9.     function Greeting()
  10.     // Results: displays a time-sensitive greeting
  11.     {
  12.         var now = new Date();
  13.         if (now.getHours() < 12) {
  14.            alert("Good morning");
  15.        }
  16.        else if (now.getHours() < 18) {
  17.            alert("Good afternoon");
  18.        }
  19.        else {
  20.            alert("Good evening");
  21.        }
  22.    }
  23.  
  24.    function Help(){
  25.        var OutputWindow=window.open();
  26.        OutputWindow.document.open();
  27.  
  28.        OutputWindow.document.write("SSSSSSSSSS WELCOME TO NEW WINDOW..");
  29.        OutputWindow.document.close();
  30.    }
  31.  
  32.    function convert(x){
  33.     return (5/9)*(x-32);
  34.    }
  35.  
  36.    function genTable(a,b,c) {
  37.    var str="";
  38.        for( i=a;i<=b;i++){
  39.            str=str+i+"  ^ "+c+" = "+Math.pow(i,c)+"\n";
  40.        }
  41.        document.Area.Text.value=str;
  42.    }
  43. </script>
  44.  
  45. <body>
  46. <form name="ButtonForm">
  47.     <input type="button" value="Click for Greeting"
  48.           onclick="Greeting();" />
  49.     <input type="button" value="Click for new window"
  50.           onclick="Help();" />
  51.     <input type="button" value="Click Me to hear name" onclick="alert('Thanks Mr. '+document.Box.user.value+ ' for joining us');">
  52.      <input type="button" value="Double" onclick="document.Box.in.value=Math.pow(document.Box.in.value,2);"/>
  53.      <input type="button" value="FarToCel" onclick="document.Box.c.value=convert(document.Box.f.value)">
  54.      <input type="button" value="Gen Table " onclick="genTable(Area.from.value,Area.to.value,Area.power.value)">
  55. </form>
  56. <form name="Box">
  57.     Enter your name here:
  58.     <input type="text" name="user" id="user" size="12" value="">
  59.     <br/><br/>
  60.     Enter your input here:
  61.     <input type="number" name="in" id="in" size="22" value="">
  62.     Enter temp:
  63.     <input type="number" name="f" id="f" size="10" value="" onchange="document.Box.c.value=convert(document.Box.f.value);">
  64.     C=>F <input type="number" name="c" id="c" size="10" value="" onfocus="blur()">
  65.     <br/><br/>
  66.  
  67.  
  68. </form>
  69. <script>
  70.     function convert(x){
  71.         return (5/9)*(x-32);
  72.     }
  73.  
  74.  
  75.  
  76. </script>
  77. <br/><br/>
  78. <form name="Area">
  79. <div style="text-align: center;display: inline-block">
  80.     from <input type="number" name="from" id="from" value="1"> to
  81.     <input type="number" name="to" id="to" value="10"> raised to power of
  82.     <input type="number" name="power" id="power" value="2">
  83.     <br/><br/>
  84.     <textarea name="Text" rows="20" cols="20">....</textarea>
  85. </div>
  86. </form>
  87.  
  88. </body>
  89. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement