prevalue_set.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="favicon.ico" type="image/x-icon">
  5. <title>Set PreValue</title>
  6. <meta charset="utf-8">
  7. <style>
  8. h1 {font-size: 2em;}
  9. h2 {font-size: 1.5em;}
  10. h3 {font-size: 1.2em;}
  11. p {font-size: 1em;}
  12. div {
  13. width: 200px;
  14. padding: 10px 5px;
  15. display: inline-block;
  16. border: 1px solid #ccc;
  17. font-size: 16px;
  18. max-height: 35px;
  19. }
  20. input[type=number] {
  21. width: 125px;
  22. padding: 10px 5px;
  23. display: inline-block;
  24. border: 1px solid #ccc;
  25. font-size: 16px;
  26. }
  27. .button {
  28. padding: 10px 20px;
  29. width: 211px;
  30. font-size: 16px;
  31. }
  32. </style>
  33. </head>
  34. <body style="font-family: arial; padding: 0px 10px;">
  35. <h3>Set the previous value for consistency check and substitution for NaN</h3>
  36. <class id="Numbers_text" style="font-size: 120%; color:black;"><b>Choose Number: </b>
  37. <select id="Numbers_value1" onchange="numberChanged()">
  38. </select>
  39. </class>
  40. <table style="width:100%">
  41. <tr>
  42. <h3>Current Value:</h3><p>
  43. <div id="prevalue"></div>
  44. <h3>Set Value:</h3><p>
  45. Input (Format = 123.456):<p>
  46. PreValue:
  47. <input type="number" id="myInput" name="myInput"
  48. pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
  49. title="This should be a number with up to 4 decimal places.">
  50. <p></p>
  51. <button class="button" type="button" onclick="setprevalue()">Set PreValue</button>
  52. </tr>
  53. <tr>
  54. <h3>Result:</h3><p>
  55. <div id="result" readonly></div>
  56. </tr>
  57. </table>
  58. </body></html>
  59. <script type="text/javascript" src="./gethost.js"></script>
  60. <script type="text/javascript" src="./readconfigcommon.js"></script>
  61. <script type="text/javascript" src="./readconfigparam.js"></script>
  62. <script type="text/javascript">
  63. var basepath = "http://192.168.178.22";
  64. var NUMBERS;
  65. function setprevalue() {
  66. var inputVal = document.getElementById("myInput").value;
  67. var sel = document.getElementById("Numbers_value1");
  68. var _number = sel.options[sel.selectedIndex].text;
  69. inputVal = inputVal.replace(",", ".");
  70. var xhttp = new XMLHttpRequest();
  71. try {
  72. url = basepath + "/setPreValue.html?value=" + inputVal + "&numbers=" + _number;
  73. xhttp.open("GET", url, false);
  74. xhttp.send();
  75. response = xhttp.responseText;
  76. document.getElementById("result").innerHTML=response;
  77. }
  78. catch (error)
  79. {
  80. // alert("Deleting Config.ini failed");
  81. }
  82. }
  83. function loadPrevalue(_basepath) {
  84. var sel = document.getElementById("Numbers_value1");
  85. var _number = sel.options[sel.selectedIndex].text;
  86. var xhttp = new XMLHttpRequest();
  87. try {
  88. url = _basepath + '/setPreValue.html?numbers=' + _number;
  89. xhttp.open("GET", url, false);
  90. xhttp.send();
  91. response = xhttp.responseText;
  92. document.getElementById("prevalue").innerHTML=response;
  93. document.getElementById("myInput").value=response;
  94. }
  95. catch (error)
  96. {
  97. // alert("Deleting Config.ini failed");
  98. }
  99. return true;
  100. }
  101. function numberChanged(){
  102. loadPrevalue(basepath);
  103. }
  104. function UpdateNUMBERS(_sel){
  105. zw = getNUMBERInfo();
  106. index = 0;
  107. var _index = document.getElementById("Numbers_value1");
  108. while (_index.length){
  109. _index.remove(0);
  110. }
  111. for (var i = 0; i < zw.length; ++i){
  112. var option = document.createElement("option");
  113. option.text = zw[i]["name"];
  114. option.value = i;
  115. _index.add(option);
  116. if (typeof _sel !== 'undefined') {
  117. if (zw[i]["name"] == _sel)
  118. index = i
  119. }
  120. }
  121. _index.selectedIndex = index;
  122. loadPrevalue(basepath);
  123. }
  124. function init(){
  125. basepath = getbasepath();
  126. loadConfig(basepath);
  127. ParseConfig();
  128. UpdateNUMBERS();
  129. loadPrevalue(basepath);
  130. }
  131. init();
  132. </script>