mode.html 1.11 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');};
      
      function sendMessage(){
	websocket.send($('#onoffswitch').is(':checked'));
	}
     
    </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>
	<button onclick="sendMessage();">Send</button>
    <div id="messages"></div>

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