Primes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 920B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Factoring</title>
  6. <style>
  7. body {
  8. height: 100%;
  9. }
  10. * {
  11. box-sizing: border-box;
  12. }
  13. #form {
  14. width: 90%;
  15. max-width: 700px;
  16. margin: auto;
  17. margin-top: 10vh;
  18. }
  19. #num {
  20. width: 80%;
  21. }
  22. #form button {
  23. width: 19%;
  24. float: right;
  25. }
  26. #form * {
  27. height: 32px;
  28. }
  29. #output {
  30. width: 100%;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <form id="form">
  36. <input id="num" type="number" pattern="\d*">
  37. <button>Factor</button>
  38. <input id="output" readonly>
  39. </form>
  40. <script>
  41. var num = document.getElementById("num");
  42. var output = document.getElementById("output");
  43. var form = document.getElementById("form");
  44. form.addEventListener("submit", function(evt) {
  45. evt.preventDefault();
  46. var xhr = new XMLHttpRequest();
  47. xhr.onload = function() {
  48. output.value = xhr.responseText;
  49. }
  50. xhr.open("GET", "/factor/"+num.value);
  51. xhr.send();
  52. });
  53. </script>
  54. </body>
  55. </html>