prevalue_set.html 3.7 KB

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