Keresés

Új hozzászólás Aktív témák

  • Tankblock

    aktív tag

    válasz Janos250 #14905 üzenetére

    Bocs, épp mindennel el vagyok foglalva csak fórumozni nincs időm...

    Na szóval javascript ugye...
    elemnek legyen id ja és akkor scriptből lehet a tulajdonságait módosítani. pl láthatóságot, bármit.

    lenti példában egy slide switch van myonoffswitch néven és loggol is az oldalra vissza.

    "<!DOCTYPE html><meta charset=\"utf-8\" /><title>ESP8266 Test Server</title><style> .onoffswitch { position: relative\; width: 90px\; -webkit-user-select:none\; -moz-user-select:none\; -ms-user-select: none\; } .onoffswitch-checkbox {display: none\;} .onoffswitch-label {display: block\; overflow: hidden\; cursor: pointer\; border: 2px solid #8F8989\; border-radius: 20px\;} .onoffswitch-inner {display: block\; width: 200%\; margin-left: -100%\; transition: margin 0.3s ease-in 0s\;} .onoffswitch-inner:before, .onoffswitch-inner:after { display: block\; float: left\; width: 50%\; height: 30px\; padding: 0\; line-height: 30px\; font-size: 14px\; color: white\; font-family: Trebuchet, Arial, sans-serif\; font-weight: bold\; box-sizing: border-box\;} .onoffswitch-inner:before { content: \"ON\"\; padding-left: 10px\; background-color: #C21515\; color: #FFFFFF\; } .onoffswitch-inner:after { content: \"OFF\"\; padding-right: 10px\; background-color: #C21515\; color: #999999\; text-align: right\;} .onoffswitch-switch {display: block\; width: 18px\; margin: 6px\; background: #A1A1A1\; position: absolute\; top: 0\; bottom: 0\; right: 56px\; border: 2px solid #8F8989\; border-radius: 20px\; transition: all 0.3s ease-in 0s\; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {margin-left: 0\;} .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {right: 0px\; background-color: #CC262C\;}</style><script language=\"javascript\" type=\"text/javascript\"> var wsUri =\"ws://"; <ide az IP címe kell>
    ":81\"\; function init(){ output = document.getElementById(\"output\")\; testWebSocket()\;} function testWebSocket(){ websocket = new WebSocket(wsUri)\; websocket.onopen = function(evt) { onOpen(evt) }\; websocket.onclose = function(evt) { onClose(evt) }\; websocket.onmessage = function(evt) { onMessage(evt) }\; websocket.onerror = function(evt) { onError(evt) }\; } function onOpen(evt) {writeToScreen(\"CONNECTED\")\; doSend(\"CONNECTED\")\; document.getElementById(\"myonoffswitch\").disabled = true\;} function onClose(evt){ writeToScreen(\"DISCONNECTED\")\;} function onMessage(evt){ var received_msg = evt.data\; writeToScreen('<span style=\"color: blue\;\">RESPONSE:' + received_msg +'</span>')\; if(received_msg == \"Connected\"){document.getElementById(\"myonoffswitch\").disabled = false\; document.getElementById(\"myonoffswitch\").checked = false\; doSend(\"GS\")\;} if(received_msg.startsWith(\"GS\")){ var l_tempSwitchStatus = received_msg.split(\":\")\; writeToScreen(\"Medve \" + l_tempSwitchStatus[1])\;  document.getElementById(\"myonoffswitch\").checked = (l_tempSwitchStatus[1] === 'true')\; document.getElementById(\"myonoffswitch\").disabled = false\;} } function onError(evt){writeToScreen('<span style=\"color: red\;\">ERROR:</span> ' + evt.data)\;} function doSend(message){writeToScreen(\"SENT:\" + message)\; websocket.send(message)\;} function writeToScreen(message){var pre = document.createElement(\"p\")\; pre.style.wordWrap = \"break-word\"\; pre.innerHTML = message\; output.appendChild(pre)\;} function checkedChanged(message){doSend('WS:'+document.getElementById(\"myonoffswitch\").checked)\;}window.addEventListener(\"load\", init, false)\; </script><h2>WebSocket Test</h2><div class=\"onoffswitch\"><input type=\"checkbox\" name=\"onoffswitch\" class=\"onoffswitch-checkbox\" id=\"myonoffswitch\" onchange=\"checkedChanged(this)\" checked ><label class=\"onoffswitch-label\" for=\"myonoffswitch\"><span class=\"onoffswitch-inner\"></span><span class=\"onoffswitch-switch\"></span></label></div><div id=\"output\"></div>";

    Nem kell oldalt töltögetni számomra az idegesítő.

    esetleg a CNLohr csatornáját ajánlom [link] esp8266 on tol valami 700Hz el weblapot és FFT vel zenéből RBG ledszallagot színez.....

    Release the Beast....

Új hozzászólás Aktív témák