Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>by Fakher_Aldeen Odeh</title>
- <script type="text/javascript">
- window.onload = function(){
- document.getElementById('cli').onclick = function(){
- var random = Math.floor(Math.random()*(8-2)+2);
- var text1 = parseInt(document.getElementById('b').value);
- var sum = 1;
- for(var i = 1;i<=random;i++){
- sum*=text1;
- }
- document.getElementById('res').innerHTML = "The result is : " + sum;
- document.getElementById('rand').innerHTML ="Generated random : " + random;
- }
- }
- </script>
- </head>
- <body>
- Type a number : <input type="text" name="t" id="b" />
- <input type="button" name="b" id="cli" value="click"/><br>
- <b id="res"></b>
- <b id="rand"></b>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement