Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Diana test</title>
  6.  
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8.  
  9. </head>
  10. <body>
  11.  
  12. <style>
  13. body {
  14. margin: 0;
  15. padding: 0;
  16. height: 100vh;
  17. display: flex;
  18. align-items: center;
  19. justify-content: center;
  20. flex-direction: column
  21. }
  22. .form__block {
  23. width: 310px;
  24. }
  25. input {
  26. border-radius: 4px;
  27. border: solid 1px #ccc;
  28. outline: none;
  29. display: inline-block;
  30. margin-right: 10px;
  31. height: 40px;
  32. padding: 0 5px;
  33. width: 100%;
  34. text-align: center;
  35. box-sizing: border-box;
  36. font-size: 14px;
  37. margin-bottom: 10px;
  38. }
  39. button {
  40. display: inline-block;
  41. border-radius: 4px;
  42. height: 40px;
  43. width: 100%;
  44. text-align: center;
  45. background: #000
  46. color: #fff;
  47. border: 0;
  48. padding: 0 10px;
  49. font-size: 14px;
  50. cursor: pointer;
  51. }
  52. #result {
  53. font-size: 14px;
  54. line-height: 24px;
  55. text-align: center;
  56. }
  57. .cbalink {
  58. display: none;
  59.  
  60. }
  61. </style>
  62. <div class="form__block">
  63. <input type="text" id="input" type="number" placeholder="Введите ваш IQ">
  64. <button class="btn-submit">Проверить</button>
  65. <div id="result"></div>
  66. </div>
  67.  
  68. <script>
  69.  
  70. let input = document.querySelector('input'),
  71. button = document.querySelector('.btn-submit'),
  72. result = document.querySelector('#result');
  73.  
  74.  
  75.  
  76. button.onclick = function() {
  77. if(input.value != '' && input.value > 0) {
  78. if(input.value > 47) {
  79. result.innerHTML = 'Вы молодец, любите Диану'
  80. } else {
  81. result.innerHTML = `Ваш IQ - ${input.value}, это очень плохо! Срочно влюбляйтесь в Диану`
  82. }
  83. } else {
  84. result.innerHTML = 'Заполните поле с IQ'
  85. }
  86. }
  87.  
  88.  
  89. </script>
  90.  
  91. </body>
  92. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement