couleur.html 1.56 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Changement de couleur</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 couleur(){
	var rouge=$('#slider').value();
	var vert=$('#slider1').value();
	var bleu=$('#slider2').value();
	websocket.send(rouge);
	websocket.send(vert);
	websocket.send(bleu);
	}
    </script>
    
</head>
<body>
<h1>Changement de couleur de votre veilleuse connectée</h1>
<h3>Rouge</h3>
<div id = "slider">
<input type ="range" min ="0" max="255" value ="100" onchange = "rangevalue.value=value">
<span class = "highlight"></span>
<output id="rangevalue">50</output>
</div>
<h3>Vert</h3>
<div id = "slider1">
    <input type ="range" min ="0" max="255" value ="100" onchange = "rangevalue1.value=value">
    <span class = "highlight"></span>
    <output id="rangevalue1">50</output>
</div>
<h3>Bleu</h3>
<div id = "slider2">
    <input type ="range" min ="0" max="255" value ="100" onchange = "rangevalue2.value=value">
    <span class = "highlight"></span>
    <output id="rangevalue2">50</output>
</div>
<h4><a href="Menu.html">Retour</a></h4>
</body>
</html>