prevalue_set.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <html><head>
  2. <title>jomjol - AI on the edge</title>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <script type="text/javascript">
  6. //<![CDATA[
  7. //]]>
  8. </script>
  9. </head>
  10. <style>
  11. h1 {font-size: 2em;}
  12. h2 {font-size: 1.5em;}
  13. p {font-size: 1em;}
  14. </style>
  15. <script>
  16. function includeHTML() {
  17. var z, i, elmnt, file, xhttp;
  18. /* Loop through a collection of all HTML elements: */
  19. z = document.getElementsByTagName("*");
  20. for (i = 0; i < z.length; i++) {
  21. elmnt = z[i];
  22. /*search for elements with a certain atrribute:*/
  23. file = elmnt.getAttribute("w3-include-html");
  24. if (file) {
  25. /* Make an HTTP request using the attribute value as the file name: */
  26. xhttp = new XMLHttpRequest();
  27. xhttp.onreadystatechange = function() {
  28. if (this.readyState == 4) {
  29. if (this.status == 200) {elmnt.innerHTML = this.responseText;}
  30. if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
  31. /* Remove the attribute, and call this function once more: */
  32. elmnt.removeAttribute("w3-include-html");
  33. includeHTML();
  34. }
  35. }
  36. xhttp.open("GET", file, true);
  37. xhttp.send();
  38. /* Exit the function: */
  39. return;
  40. }
  41. }
  42. }
  43. </script>
  44. <body style="font-family: arial">
  45. <table style="width:100%">
  46. <tr>
  47. <h2>Current Value:</h2><p>
  48. <div w3-include-html="/setPreValue.html"></div>
  49. </tr>
  50. <tr>
  51. <h2>Set Value:</h2><p>
  52. Input (Format = 123.456):<p>
  53. PreValue:
  54. <input type="number" id="myInput" name="myInput"
  55. pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
  56. title="This should be a number with up to 4 decimal places.">
  57. <button type="button" onclick="setprevalue()">Set PreValue</button>
  58. </tr>
  59. <tr>
  60. <h2>Result:</h2><p>
  61. <div id="result"> </div>
  62. </tr>
  63. </table>
  64. <script>
  65. function setprevalue() {
  66. var inputVal = document.getElementById("myInput").value;
  67. inputVal = inputVal.replace(",", ".");
  68. _value = "<object data=" + "/setPreValue.html?value=" + inputVal + " ></object>";
  69. document.getElementById("result").innerHTML=_value;
  70. // location.reload();
  71. }
  72. </script>
  73. <script>
  74. includeHTML();
  75. </script>
  76. </body></html>