Advertisement
cindy_wijaya

Kontrol On/Off

Feb 19th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
  5. <title>Kontrol On/Off</title>
  6. <script type="text/javascript" src="includes/swfobject.js"></script>
  7. <script src="includes/jquery.js"></script>
  8. <script>
  9. $(document).ready(function()
  10. {
  11. $('div.light').html('<img src="images/off.png" width="50" height="50">')
  12.  
  13. setInterval(function()
  14. {
  15. $('#timeval').load('includes/time.php');
  16. }, 1000);  
  17.  
  18. $('.light').click(function()
  19. {
  20.     $('.debug').load('handlers/light.php');
  21.  
  22.     setTimeout(function()
  23.     {
  24.     var mydata = $('div.debug').text();
  25.     if (mydata == 1)
  26.         {
  27.         $.getScript("audio_handlers/audio.php");
  28.         $('div.light').html('<img src="images/on.png" width="50" height="50">')
  29.         $('div.status').text("Lampu Nyala")
  30.         }
  31.     else if (mydata == 0)
  32.         {
  33.         $.getScript("audio_handlers/audio.php");
  34.         $('div.light').html('<img src="images/off.png" width="50" height="50">')
  35.         $('div.status').text("Lampu Mati")
  36.         }
  37. ;}, 100);
  38. });
  39. });
  40. </script>
  41. </head>
  42.  
  43. <body>
  44. <div></div>
  45. <div id="timeval"></div>
  46. <div id="sound_container"></div>
  47. <h1>Nyalakan Lampu On/Off</h1>
  48. <div class="light" >Image On/Off disini</div>
  49. <div class="debug"  style="display: none;">Mulai</div>
  50. <div class="status" > Lampu Mati </div>
  51. <p>Dinas Perhubungan  <a href="http://openwrt.org" target="_blank">Kota Tegal</a> </p>
  52. </body>
  53.  
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement