ESP8266 Treppenlichtsteuerung mit OTA zum Firmware Upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

input.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // var slider = document.getElementById("helligkeit");
  2. // var output = document.getElementById("l_pwm");
  3. // output.innerHTML = slider.value; // Display the default slider value
  4. // // Update the current slider value (each time you drag the slider handle)
  5. // slider.oninput = function() {
  6. // output.innerHTML = this.value;
  7. // }
  8. let xhr = new XMLHttpRequest();
  9. xhr.onreadystatechange = function(){
  10. if(xhr.readyState == 4) {
  11. if (xhr.status == 200){
  12. console.log(xhr.responseText);
  13. terminal = document.getElementById("term");
  14. autoscroll = document.getElementById("scroll");
  15. terminal.innerHTML += xhr.responseText;
  16. if(autoscroll.checked)
  17. terminal.scrollTop = terminal.scrollHeight;
  18. }
  19. else {
  20. console.log("status:", xhr.status);
  21. }
  22. }
  23. }
  24. function reloadTerminal() {
  25. xhr.open("POST", "/app=terminal", true);
  26. xhr.send();
  27. setTimeout(reloadTerminal, 1000);
  28. };
  29. reloadTerminal();
  30. function clearTerminal() {
  31. document.getElementById("term").innerHTML = '';
  32. }