mode.html 1.18 KB
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="mode.css" />
    <title>Changement de mode</title>

    <script src="jquery.js"></script>
    <script type= "text/javascript">
      window.WebSocket = (window.WebSocket || window.MozWebSocket);
      var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol');
      websocket.onerror=function(){ $('h1').css('color','red');};
      websocket.onopen=function(){ $('h1').css('color','green');};
      
      
      webscket.onmessage=function(message){
      console.log(message.data);
      $('#messages').append($('<p>',{ text: message.data}));
	};

	function mode(){
	var message=$('#myonoffswitch').checked;
	websocket.send(message);

	}
    </script>
    
</head>
<body>
<h1>Changement de mode de votre veilleuse connectée</h1>
<div class="onoffswitch">
    <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked>
    <label class="onoffswitch-label" for="myonoffswitch">
        <span class="onoffswitch-inner"></span>
        <span class="onoffswitch-switch"></span>
    </label>
</div>

<h3><a href="Menu.html">Retour</a></h3>
</body>
</html>