ItsLars

Html

Dec 30th, 2017
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.49 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. </head>
  6. <body>
  7.  
  8.   <p>Aan/Uit</p>
  9.     <form>
  10.         <input onclick="On()" type="button" value="On"> <input onclick="Off()" type="button" value="Off"><br>
  11.         <br>
  12.     </form>
  13.     <p>Effecten</p>
  14.     <form>
  15.         <input onclick="Rainbow()" type="button" value="Rainbow"><input onclick="Blink()" type="button" value="Blink"><input onclick="Breath()" type="button" value="Breath"><input onclick="ColorWipe()" type="button" value="ColorWipe">
  16.     </form>
  17.     <p>Kleuren</p>
  18.     <form>
  19.         <input onclick="Rood()" type="button" value="Rood"><input onclick="Blauw()" type="button" value="Blauw"><input onclick="Rose()" type="button" value="Rose"><input onclick="Wit()" type="button" value="Wit">
  20.     </form>
  21. <script type="text/javascript">
  22.  
  23. function On() {
  24.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  25.     exampleSocket.onopen = function(event) {
  26.         console.log('Connection Open');
  27.         exampleSocket.send('/0');
  28.     };
  29.     exampleSocket.onmessage = function(event) {
  30.         console.log(event.data);
  31.     }
  32. }
  33.  
  34. function Off() {
  35.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  36.     exampleSocket.onopen = function(event) {
  37.         console.log('Connection Open');
  38.         exampleSocket.send('=off');
  39.     };
  40.     exampleSocket.onmessage = function(event) {
  41.         console.log(event.data);
  42.     }
  43. }
  44.  
  45. function Rainbow() {
  46.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  47.     exampleSocket.onopen = function(event) {
  48.         console.log('Connection Open');
  49.         exampleSocket.send('/11');
  50.     };
  51.     exampleSocket.onmessage = function(event) {
  52.         console.log(event.data);
  53.     }
  54. }
  55.  
  56. function Blink() {
  57.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  58.     exampleSocket.onopen = function(event) {
  59.         console.log('Connection Open');
  60.         exampleSocket.send('/1');
  61.     };
  62.     exampleSocket.onmessage = function(event) {
  63.         console.log(event.data);
  64.     }
  65. }
  66.  
  67. function Breath() {
  68.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  69.     exampleSocket.onopen = function(event) {
  70.         console.log('Connection Open');
  71.         exampleSocket.send('/2');
  72.     };
  73.     exampleSocket.onmessage = function(event) {
  74.         console.log(event.data);
  75.     }
  76. }
  77.  
  78. function ColorWipe() {
  79.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  80.     exampleSocket.onopen = function(event) {
  81.         console.log('Connection Open');
  82.         exampleSocket.send('/3');
  83.     };
  84.     exampleSocket.onmessage = function(event) {
  85.         console.log(event.data);
  86.     }
  87. }
  88.  
  89. function Rood() {
  90.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  91.     exampleSocket.onopen = function(event) {
  92.         console.log('Connection Open');
  93.         exampleSocket.send('*FF000D');
  94.     };
  95.     exampleSocket.onmessage = function(event) {
  96.         console.log(event.data);
  97.     }
  98. }
  99.  
  100. function Blauw() {
  101.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  102.     exampleSocket.onopen = function(event) {
  103.         console.log('Connection Open');
  104.         exampleSocket.send('*0800FF');
  105.     };
  106.     exampleSocket.onmessage = function(event) {
  107.         console.log(event.data);
  108.     }
  109. }
  110.  
  111. function Rose() {
  112.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  113.     exampleSocket.onopen = function(event) {
  114.         console.log('Connection Open');
  115.         exampleSocket.send('*FF00DC');
  116.     };
  117.     exampleSocket.onmessage = function(event) {
  118.         console.log(event.data);
  119.     }
  120. }
  121.  
  122. function Wit() {
  123.     var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
  124.     exampleSocket.onopen = function(event) {
  125.         console.log('Connection Open');
  126.         exampleSocket.send('*FFFFFF');
  127.     };
  128.     exampleSocket.onmessage = function(event) {
  129.         console.log(event.data);
  130.     }
  131. }
  132.  
  133.  
  134. </script>
  135. </body>
  136. </html>
Advertisement
Add Comment
Please, Sign In to add comment