[php] a
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Kendali LED Meja Warung Makan</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- text-align: center;
- }
- .button-container {
- margin-top: 20px;
- }
- button {
- padding: 10px 20px;
- font-size: 18px;
- margin: 10px;
- cursor: pointer;
- }
- .led-on {
- background-color: green; /* Warna untuk meja dengan LED menyala */
- color: white;
- }
- #status {
- margin-top: 20px;
- }
- </style>
- </head>
- <body>
- <h1>Kendali LED Meja Warung Makan</h1>
- <div class="button-container">
- <button id="meja1" onclick="sendCommand(1)">Meja 1</button>
- <button id="meja2" onclick="sendCommand(2)">Meja 2</button>
- <button id="meja3" onclick="sendCommand(3)">Meja 3</button>
- </div>
- <div id="status"></div>
- <script>
- // Fungsi untuk mengirimkan perintah ke server (PHP) saat tombol ditekan
- function sendCommand(meja) {
- var xhr = new XMLHttpRequest();
- var url = "control.php?meja=" + meja;
- xhr.open("GET", url, true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4 && xhr.status == 200) {
- document.getElementById("status").innerHTML = xhr.responseText;
- // Menandai tombol meja yang LED-nya telah dinyalakan
- var button = document.getElementById("meja" + meja);
- if (xhr.responseText.includes("dihidupkan")) {
- button.classList.add("led-on");
- } else if (xhr.responseText.includes("dimatikan")) {
- button.classList.remove("led-on");
- }
- }
- };
- xhr.send();
- }
- </script>
- </body>
- </html>
Editor
You can edit this paste and save as new: