Blame view

Application_raspberryJustine/pageHTML/mode.html 1.18 KB
c974479b   csaad   réorganisation de...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  <!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>