Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <script>
  4. function check() {
  5. var value = document.forms['form']['y'].value;
  6. if (isNaN(value) || value < -5 || value > 5)
  7. {
  8. highlight();
  9. return false;
  10. }
  11. return true;
  12. }
  13. function highlight() {
  14. var inputbox = document.getElementById('yInput');
  15. var alertText = document.getElementById('alertText');
  16. inputbox.className = "alerted";
  17. alertText.className = "alertText";
  18. }
  19. function unhighlight() {
  20. var inputbox = document.getElementById('yInput');
  21. var alertText = document.getElementById('alertText');
  22. inputbox.className = "";
  23. alertText.className = "invisible";
  24. }
  25. </script>
  26. <style>
  27. .signature {
  28. text-align: right;
  29. padding: 10px;
  30. color: #222;
  31. font: monospace;
  32. font-size: 12px;
  33. }
  34. p {
  35. font: sans-serif;
  36. font-size: 14px;
  37. font-weight: 500;
  38. }
  39. select {
  40. width: 100%;
  41. height: 100%;
  42. border-color: rgb(51, 153, 255);
  43. border-width: 3px;
  44. border-radius: 4px;
  45. }
  46. input[type="text"].alerted {
  47. border-width: 3px !important;
  48. border-color: red !important;
  49. padding: 0px;
  50. }
  51. input[type="text"] {
  52. border-width: 2px;
  53. border-color: rgb(51, 153, 255);
  54. border-radius: 4px;
  55. }
  56. .invisible {
  57. display: none !important;
  58. }
  59. p.alertText {
  60. color: red !important;
  61. }
  62. input[type="radio"] {
  63. display: none;
  64. }
  65. label {
  66. height: 100%;
  67. }
  68. label > p {
  69. height: 100%;
  70. width: 100%;
  71. text-align: center;
  72. }
  73. label:hover > p {
  74. background-color: #eee;
  75. }
  76. input:checked ~ p {
  77. color: white;
  78. background-color: rgb(51, 153, 255);
  79. }
  80. input[type="submit"] {
  81. border: none;
  82. width: 100%;
  83. color: white;
  84. background-color: rgb(60, 170, 255);
  85. }
  86. input[type="submit"]:hover {
  87. background-color: rgb(51, 153, 255);
  88. }
  89. </style>
  90. </head>
  91. <body>
  92. <table width="100%">
  93. <tr valign="center">
  94. <td>
  95. <h1>Попадание точки в область</h1>
  96. </td>
  97. <td class="signature">
  98. Лабутина Ксения<br>
  99. P3213<br>
  100. 213008 вариант
  101. </tr>
  102. <tr><td><form name="form" action="script.php" method="post" onsubmit="return check()">
  103. <table>
  104. <tr><td colspan="2"><img src="areas1.png"></td></tr>
  105. <tr>
  106. <td valign="center"><p> x: </p></td>
  107. <td valign="center"><select name="x">
  108. <option selected value="-4">-4</option>
  109. <option value="-3">-3</option>
  110. <option value="-2">-2</option>
  111. <option value="-1">-1</option>
  112. <option value="0">0</option>
  113. <option value="1">1</option>
  114. <option value="2">2</option>
  115. <option value="3">3</option>
  116. <option value="4">-4</option>
  117. </select></td>
  118. </tr>
  119. <tr>
  120. <td valign="center"><p> y: </p></td><td><input id="yInput" type="text" name="y" onfocus="unhighlight()"></td><td><p id="alertText" class="invisible">y должно быть числом от -5 до 5</div>
  121. </tr>
  122. <tr><td><p> r: </p></td><td>
  123. <table width="100%" cellpadding="0" cellspacing="0" class = "select"><tr>
  124. <td width="20%"><label><input type="radio" name="r" value="1" checked><p>1</p></label></td>
  125. <td width="20%"><label><input type="radio" name="r" value="1.5"><p>1.5</p></label></td>
  126. <td width="20%"><label><input type="radio" name="r" value="2"><p>2</p></label></td>
  127. <td width="20%"><label><input type="radio" name="r" value="2.5"><p>2.5</p></label></td>
  128. <td width="20%"><label><input type="radio" name="r" value="3"><p>3</p></label></td>
  129. </tr></table></td></tr>
  130. <tr><td colspan="2">
  131. <input type="submit" name="submit" value="тык"></td></tr>
  132. </table>
  133.  
  134. </form></td></tr>
  135. </table>
  136. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement