Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>MathJax example</title>
  7. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  8.  
  9. <script type="text/javascript" async
  10. src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async>
  11. </script>
  12. <script type="text/x-mathjax-config">
  13. MathJax.Hub.Config({
  14. "HTML-CSS": { scale: 200, linebreaks: { automatic: false } },
  15. SVG: { linebreaks: { automatic:false } },
  16. displayAlign: "left" });
  17. </script>
  18. </head>
  19.  
  20. <style>
  21. a {
  22. position: relative;
  23. display: inline-block;
  24. padding: 1.2em 2em;
  25. text-decoration: none;
  26. text-align: center;
  27. cursor: pointer;
  28. user-select: none;
  29. color: white;
  30.  
  31. &::before {
  32. content: '';
  33. position: absolute;
  34. top: 0;
  35. left: 0;
  36. bottom: 0;
  37. right: 0;
  38. background: linear-gradient(135deg, #6e8efb, #a777e3);
  39. border-radius: 4px;
  40. transition: box-shadow .5s ease, transform .2s ease;
  41. will-change: transform;
  42. box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
  43. transform:
  44. translateY(var(--ty, 0))
  45. rotateX(var(--rx, 0))
  46. rotateY(var(--ry, 0))
  47. translateZ(var(--tz, -12px));
  48. }
  49.  
  50. &:hover::before {
  51. box-shadow: 0 5px 15px rgba(0, 0, 0, .3);
  52. }
  53.  
  54. &::after {
  55. position: relative;
  56. display: inline-block;
  57. content: attr(data-title);
  58. transition: transform .2s ease;
  59. font-weight: bold;
  60. letter-spacing: .01em;
  61. will-change: transform;
  62. transform:
  63. translateY(var(--ty, 0))
  64. rotateX(var(--rx, 0))
  65. rotateY(var(--ry, 0));
  66. }
  67. }
  68.  
  69. </style>
  70.  
  71. <body>
  72.  
  73. <p>
  74. Найдите корень уравнения: \(2-5(x+7) = -4x+3\)
  75. </p>
  76. Ответ:
  77. <input size="10" type="text" name="answer_5_rat_5" title="-36" class="test_inp" id="answer1">
  78. <p>
  79. Решите уравнение \(x^2 + 10000 = 200x\). Если уравнение имеет более одного корня, в ответе запишите больший из корней.
  80. </p>
  81. Ответ:
  82. <input size="10" type="text" name="answer_5_rat_1" class="test_inp" title="100" id="answer2">
  83.  
  84. <p>
  85. Решите уравнение \(-(x+2)^2 = -2-x \). Если уравнение имеет более одного корня, в ответе запишите больший из корней.
  86. </p>
  87. Ответ:
  88. <input size="10" type="text" name="answer_5_rat_2" class="test_inp" title="-1" id="answer3">
  89.  
  90. <p>
  91. <button type="button" id="1" class="btn btn-primary">Проверка</button>
  92. </p>
  93.  
  94. <div id="result">
  95.  
  96. </div>
  97.  
  98. <main role="main" class="container">
  99.  
  100. </main>
  101.  
  102. </body>
  103.  
  104. <script>
  105. var count = 0;
  106. var inputs =document.getElementsByTagName('input').length;
  107.  
  108. $("#1").click(function() {
  109. var inputVal = $("#answer1");
  110. console.log(inputVal.attr('title'));
  111. if (inputVal.val() === inputVal.attr('title')) {
  112. inputVal.css("backgroundColor", "green");
  113. count++;
  114. } else {
  115. inputVal.css("backgroundColor", "red");
  116. }
  117.  
  118. var inputVal1 = $("#answer2")
  119. if (inputVal1.val() === inputVal1.attr('title')) {
  120. inputVal1.css("backgroundColor", "green");
  121. count++;
  122. } else {
  123. inputVal1.css("backgroundColor", "red");
  124. }
  125.  
  126. var inputVal2 = $("#answer3")
  127. if (inputVal2.val() === inputVal2.attr('title')) {
  128. inputVal2.css("backgroundColor", "green");
  129. count++;
  130. } else {
  131. inputVal2.css("backgroundColor", "red");
  132. }
  133.  
  134. $("#result").text("Вы решили правильно " + count + " из " + inputs + " заданий")
  135. count = 0;
  136. })
  137. </script>
  138.  
  139. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement