Advertisement
viditkothari

Assignment3

Sep 15th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!-- Assignment #3: WAP to input user’s marks details & as the user clicks on the button in the form, his percentage is declared. -->
  3. <html>
  4.     <head>
  5.         <title>Result Calculator</title>
  6.         <script type="text/javascript">
  7.             function showResult()
  8.                 {
  9.                     var n,i;
  10.                     var m=new Array(5);
  11.                     var r=0;
  12.                     n = prompt("Enter you name:");
  13.                     for(i=0;i<m.length;i++)
  14.                        {
  15.                            m[i]=Number(prompt('Enter marks for ' + i + 'th subject:'));
  16.                            r=r+m[i];
  17.                        }
  18.                    r=r/m.length;
  19.                    alert(n + ', you scored '+ r + "%");
  20.                }
  21.        </script>
  22.     </head>
  23.     <body>
  24.         <p style="background-color:#FF3399;color:#FFF;padding:10px;width:50px;" onclick="showResult()">Percentage</p>
  25.     </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement