12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Factoring</title>
-
- <style>
- body {
- height: 100%;
- }
-
- * {
- box-sizing: border-box;
- }
-
- #form {
- width: 90%;
- max-width: 700px;
- margin: auto;
- margin-top: 10vh;
- }
-
- #num {
- width: 80%;
- }
- #form button {
- width: 19%;
- float: right;
- }
-
- #form * {
- height: 32px;
- }
-
- #output {
- width: 100%;
- }
-
- </style>
- </head>
- <body>
- <form id="form">
- <input id="num" type="number" pattern="\d*">
- <button>Factor</button>
- <input id="output" readonly>
- </form>
-
- <script>
-
- var num = document.getElementById("num");
- var output = document.getElementById("output");
- var form = document.getElementById("form");
-
- form.addEventListener("submit", function(evt) {
- evt.preventDefault();
-
- var xhr = new XMLHttpRequest();
- xhr.onload = function() {
- output.value = xhr.responseText;
- }
- xhr.open("GET", "/factor/"+num.value);
- xhr.send();
- });
-
- </script>
- </body>
- </html>
|