Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>JD-form2</title>
- </head>
- <script type="text/javascript">
- function Greeting()
- // Results: displays a time-sensitive greeting
- {
- var now = new Date();
- if (now.getHours() < 12) {
- alert("Good morning");
- }
- else if (now.getHours() < 18) {
- alert("Good afternoon");
- }
- else {
- alert("Good evening");
- }
- }
- function Help(){
- var OutputWindow=window.open();
- OutputWindow.document.open();
- OutputWindow.document.write("SSSSSSSSSS WELCOME TO NEW WINDOW..");
- OutputWindow.document.close();
- }
- function convert(x){
- return (5/9)*(x-32);
- }
- function genTable(a,b,c) {
- var str="";
- for( i=a;i<=b;i++){
- str=str+i+" ^ "+c+" = "+Math.pow(i,c)+"\n";
- }
- document.Area.Text.value=str;
- }
- </script>
- <body>
- <form name="ButtonForm">
- <input type="button" value="Click for Greeting"
- onclick="Greeting();" />
- <input type="button" value="Click for new window"
- onclick="Help();" />
- <input type="button" value="Click Me to hear name" onclick="alert('Thanks Mr. '+document.Box.user.value+ ' for joining us');">
- <input type="button" value="Double" onclick="document.Box.in.value=Math.pow(document.Box.in.value,2);"/>
- <input type="button" value="FarToCel" onclick="document.Box.c.value=convert(document.Box.f.value)">
- <input type="button" value="Gen Table " onclick="genTable(Area.from.value,Area.to.value,Area.power.value)">
- </form>
- <form name="Box">
- Enter your name here:
- <input type="text" name="user" id="user" size="12" value="">
- <br/><br/>
- Enter your input here:
- <input type="number" name="in" id="in" size="22" value="">
- Enter temp:
- <input type="number" name="f" id="f" size="10" value="" onchange="document.Box.c.value=convert(document.Box.f.value);">
- C=>F <input type="number" name="c" id="c" size="10" value="" onfocus="blur()">
- <br/><br/>
- </form>
- <script>
- function convert(x){
- return (5/9)*(x-32);
- }
- </script>
- <br/><br/>
- <form name="Area">
- <div style="text-align: center;display: inline-block">
- from <input type="number" name="from" id="from" value="1"> to
- <input type="number" name="to" id="to" value="10"> raised to power of
- <input type="number" name="power" id="power" value="2">
- <br/><br/>
- <textarea name="Text" rows="20" cols="20">....</textarea>
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement