index.html 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!doctype html>
  2. <html class="no-js" lang="">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="x-ua-compatible" content="ie=edge">
  6. <title>Formation jQuery</title>
  7. <meta name="description" content="">
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link rel="manifest" href="site.webmanifest">
  10. <link rel="apple-touch-icon" href="icon.png">
  11. <!-- Place favicon.ico in the root directory -->
  12. <link rel="stylesheet" href="css/normalize.css">
  13. <link rel="stylesheet" href="css/main.css">
  14. <link rel="stylesheet" href="css/styles.css">
  15. </head>
  16. <body>
  17. <!--[if lte IE 9]>
  18. <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
  19. <![endif]-->
  20. <!-- Add your site or application content here -->
  21. <div class="container">
  22. <p>Hello world! This is HTML5 Boilerplate.</p>
  23. <p>Today's date: <span id="todaysDate"></span>.</p>
  24. <p>Enter your name please:</p>
  25. <form id="helloForm">
  26. <input id="inputName" value="" />
  27. <button class="blue" type="submit">Say hello again</button>
  28. </form>
  29. <button class="red" id="clearForm" type="button">Clear form</button>
  30. <div id="ajax"></div>
  31. <button class="blue" id="getAjax" type="button">Get HTML with Ajax</button>
  32. </div>
  33. <script src="js/vendor/modernizr-3.5.0.min.js"></script>
  34. <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
  35. <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
  36. <script src="js/plugins.js"></script>
  37. <script src="js/main.js"></script>
  38. <!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
  39. <script>
  40. window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
  41. ga('create','UA-XXXXX-Y','auto');ga('send','pageview')
  42. </script>
  43. <script src="https://www.google-analytics.com/analytics.js" async defer></script>
  44. <script>
  45. var form = document.getElementById('helloForm');
  46. var input = document.getElementById('inputName');
  47. var clearButton = document.getElementById('clearForm');
  48. var dateSpan = document.getElementById('todaysDate');
  49. var ajaxButton = document.getElementById('getAjax');
  50. function sayHelloAgain(e) {
  51. e.preventDefault();
  52. alert('Hello ' + input.value);
  53. }
  54. function clearForm() {
  55. input.value = '';
  56. }
  57. function showDate() {
  58. var date = new Date().toString();
  59. dateSpan.innerHTML = date;
  60. }
  61. showDate();
  62. setInterval(showDate, 1000);
  63. function loadDoc() {
  64. var xhttp = new XMLHttpRequest();
  65. xhttp.onreadystatechange = function() {
  66. if (this.readyState == 4 && this.status == 200) {
  67. document.getElementById("ajax").innerHTML = this.responseText;
  68. }
  69. };
  70. xhttp.open("GET", "some-text.html", true);
  71. xhttp.send();
  72. }
  73. form.onsubmit = sayHelloAgain;
  74. clearButton.onclick = clearForm;
  75. ajaxButton.onclick = loadDoc;
  76. </script>
  77. </body>
  78. </html>