index.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. $(document).ready(function() {
  46. var form = $('#helloForm');
  47. var input = $('#inputName');
  48. var clearButton = $('#clearForm');
  49. var dateSpan = $('#todaysDate');
  50. var ajaxButton = $('#getAjax');
  51. function sayHelloAgain(e) {
  52. e.preventDefault();
  53. alert('Hello ' + input.val());
  54. }
  55. function clearForm() {
  56. input.val('');
  57. }
  58. function showDate() {
  59. var date = new Date().toString();
  60. dateSpan.html(date);
  61. }
  62. showDate();
  63. setInterval(showDate, 1000);
  64. function loadDoc() {
  65. $.get('some-text.html', function(html) {
  66. $('#ajax').html(html);
  67. });
  68. }
  69. form.submit(sayHelloAgain);
  70. clearButton.click(clearForm);
  71. ajaxButton.click(loadDoc);
  72. });
  73. </script>
  74. </body>
  75. </html>