Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Class Activity 1.1</title>
  7. <style id="jsbin-css">
  8. * {
  9. font-family: helvetica;
  10. font-size: 12pt;
  11. }
  12.  
  13. p{
  14. text-align: center;
  15. }
  16. input{
  17. border:0;
  18. border-bottom: dotted;
  19.  
  20. }
  21. button{
  22. border: none;
  23. text-align: center;
  24. text-decoration: none;
  25. display: inline-block;
  26. }
  27. div{
  28. text-align: center;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33.  
  34. <p><label>Name</label>
  35. <input id="player" type="text">
  36. <br>
  37. <br>
  38. <label>Enter Number</label>
  39. <input id="input" type="number">
  40. <br>
  41. <br>
  42. <button type="reset">Reset</button>
  43. <button type="submit" onclick="guessAnyNumber()">Guess</button>
  44. <div id="output"></div>
  45. </p>
  46. <script id="jsbin-javascript">
  47. const i = 100;
  48.  
  49. function guessAnyNumber(){
  50.  
  51. var myplayer=document.getElementById("player").value;
  52. var myinput = document.getElementById("input").value;
  53.  
  54. if (myinput < i){
  55. document.getElementById("output").innerHTML="The input is lower than the actual number";
  56.  
  57. }
  58. else if (myinput > i){
  59. document.getElementById("output").innerHTML="The input is higher than the actual number";
  60.  
  61. }
  62. else{
  63. document.getElementById("output").innerHTML="The input is the right number";
  64.  
  65. }
  66. }
  67. </script>
  68.  
  69.  
  70. <script id="jsbin-source-css" type="text/css">* {
  71. font-family: helvetica;
  72. font-size: 12pt;
  73. }
  74.  
  75. p{
  76. text-align: center;
  77. }
  78. input{
  79. border:0;
  80. border-bottom: dotted;
  81.  
  82. }
  83. button{
  84. border: none;
  85. text-align: center;
  86. text-decoration: none;
  87. display: inline-block;
  88. }
  89. div{
  90. text-align: center;
  91. }</script>
  92.  
  93. <script id="jsbin-source-javascript" type="text/javascript">
  94. const i = 100;
  95.  
  96. function guessAnyNumber(){
  97.  
  98. var myplayer=document.getElementById("player").value;
  99. var myinput = document.getElementById("input").value;
  100.  
  101. if (myinput < i){
  102. document.getElementById("output").innerHTML="The input is lower than the actual number";
  103.  
  104. }
  105. else if (myinput > i){
  106. document.getElementById("output").innerHTML="The input is higher than the actual number";
  107.  
  108. }
  109. else{
  110. document.getElementById("output").innerHTML="The input is the right number";
  111.  
  112. }
  113. }
  114.  
  115. </script></body>
  116. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement