Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!-- Assignment #3: WAP to input user’s marks details & as the user clicks on the button in the form, his percentage is declared. -->
- <html>
- <head>
- <title>Result Calculator</title>
- <script type="text/javascript">
- function showResult()
- {
- var n,i;
- var m=new Array(5);
- var r=0;
- n = prompt("Enter you name:");
- for(i=0;i<m.length;i++)
- {
- m[i]=Number(prompt('Enter marks for ' + i + 'th subject:'));
- r=r+m[i];
- }
- r=r/m.length;
- alert(n + ', you scored '+ r + "%");
- }
- </script>
- </head>
- <body>
- <p style="background-color:#FF3399;color:#FFF;padding:10px;width:50px;" onclick="showResult()">Percentage</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement