prevalue_set.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. <option value="0" selected>default</option>
  39. <option value="1" >NT</option>
  40. <option value="2" >HT</option>
  41. </select>
  42. </class>
  43. <table style="width:100%">
  44. <tr>
  45. <h3>Current Value:</h3><p>
  46. <div id="prevalue"></div>
  47. <h3>Set Value:</h3><p>
  48. Input (Format = 123.456):<p>
  49. PreValue:
  50. <input type="number" id="myInput" name="myInput"
  51. pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
  52. title="This should be a number with up to 4 decimal places.">
  53. <p></p>
  54. <button class="button" type="button" onclick="setprevalue()">Set PreValue</button>
  55. </tr>
  56. <tr>
  57. <h3>Result:</h3><p>
  58. <div id="result" readonly></div>
  59. </tr>
  60. </table>
  61. </body></html>
  62. <script type="text/javascript" src="./gethost.js"></script>
  63. <script type="text/javascript" src="./readconfigcommon.js"></script>
  64. <script type="text/javascript" src="./readconfigparam.js"></script>
  65. <script type="text/javascript">
  66. var basepath = "http://192.168.178.22";
  67. var NUMBERS;
  68. function setprevalue() {
  69. var inputVal = document.getElementById("myInput").value;
  70. var sel = document.getElementById("Numbers_value1");
  71. var _number = sel.options[sel.selectedIndex].text;
  72. inputVal = inputVal.replace(",", ".");
  73. var xhttp = new XMLHttpRequest();
  74. try {
  75. url = basepath + "/setPreValue.html?value=" + inputVal + "&numbers=" + _number;
  76. xhttp.open("GET", url, false);
  77. xhttp.send();
  78. response = xhttp.responseText;
  79. document.getElementById("result").innerHTML=response;
  80. }
  81. catch (error)
  82. {
  83. // alert("Deleting Config.ini failed");
  84. }
  85. }
  86. function loadPrevalue(_basepath) {
  87. var sel = document.getElementById("Numbers_value1");
  88. var _number = sel.options[sel.selectedIndex].text;
  89. var xhttp = new XMLHttpRequest();
  90. try {
  91. url = _basepath + '/setPreValue.html?numbers=' + _number;
  92. xhttp.open("GET", url, false);
  93. xhttp.send();
  94. response = xhttp.responseText;
  95. document.getElementById("prevalue").innerHTML=response;
  96. }
  97. catch (error)
  98. {
  99. // alert("Deleting Config.ini failed");
  100. }
  101. return true;
  102. }
  103. function numberChanged(){
  104. loadPrevalue(basepath);
  105. }
  106. function UpdateNUMBERS(_sel){
  107. zw = getNUMBERInfo();
  108. index = 0;
  109. var _index = document.getElementById("Numbers_value1");
  110. while (_index.length){
  111. _index.remove(0);
  112. }
  113. for (var i = 0; i < zw.length; ++i){
  114. var option = document.createElement("option");
  115. option.text = zw[i]["name"];
  116. option.value = i;
  117. _index.add(option);
  118. if (typeof _sel !== 'undefined') {
  119. if (zw[i]["name"] == _sel)
  120. index = i
  121. }
  122. }
  123. _index.selectedIndex = index;
  124. loadPrevalue(basepath);
  125. }
  126. function init(){
  127. basepath = getbasepath();
  128. loadConfig(basepath);
  129. ParseConfig();
  130. UpdateNUMBERS();
  131. loadPrevalue(basepath);
  132. }
  133. init();
  134. </script>