.innerhtml problem

Hi,

I have this HTML code:

<!DOCTYPE html>
<html>
    <head>
        <title>Remote Control</title>
        <script>
		strLED1 = "";
		strLED2 = "";
		strLED3 = "";
		strLED4 = "";
		strLED5 = "";
		var LED2_state = 0;
		var LED3_state = 0;
		var LED4_state = 0;
		var LED5_state = 0;
		function GetArduinoIO()
		{
			nocache = "&nocache=" + Math.random() * 1000000;
			var request = new XMLHttpRequest();
			request.onreadystatechange = function()
			{
				if (this.readyState == 4) {
					if (this.status == 200) {
						if (this.responseXML != null) {
						
							var count;
							
							// LED 1
							if (this.responseXML.getElementsByTagName('LED')[0].childNodes[0].nodeValue === "checked") {
								document.LED_form.LED1.checked = true;
							}
							else {
								document.LED_form.LED1.checked = false;
							}
							
							// LED 2
							if (this.responseXML.getElementsByTagName('LED')[1].childNodes[0].nodeValue === "on") {
								document.getElementById("LED2").innerHTML = "LED 2 is ON (D7)";
								LED2_state = 1;
							}
							else {
								document.getElementById("LED2").innerHTML = "LED 2 is OFF (D7)";
								LED2_state = 0;
							}
							// LED 3
							if (this.responseXML.getElementsByTagName('LED')[2].childNodes[0].nodeValue === "on") {
								document.getElementById("LED3").innerHTML = "LED 3 is ON";
								LED3_state = 1;
							}
							else {
								document.getElementById("LED3").innerHTML = "LED 3 is OFF";
								LED3_state = 0;
							}
							// LED 4
							if (this.responseXML.getElementsByTagName('LED')[3].childNodes[0].nodeValue === "on") {
								document.getElementById("LED4").innerHTML = "LED 4 is ON";
								LED4_state = 1;
							}
							else {
								document.getElementById("LED4").innerHTML = "LED 4 is OFF";
								LED4_state = 0;
							}
							// LED 5
							if (this.responseXML.getElementsByTagName('LED')[4].childNodes[0].nodeValue === "on") {
								document.getElementById("LED5").innerHTML = "LED 5 is ON";
								LED5_state = 1;
							}
							else {
								document.getElementById("LED5").innerHTML = "LED 5 is OFF";
								LED5_state = 0;
							}
							
							
						}
					}
				}
			}
			// HTTP GET
			request.open("GET", "ajax_inputs" + strLED1 + strLED2 + strLED3 + strLED4 + strLED5 + nocache, true);
			request.send(null);
			setTimeout('GetArduinoIO()', 1000);
			strLED1 = "";
			strLED2 = "";
			strLED3 = "";
			strLED4 = "";
			strLED5 = "";
		}
		// checked/unchecked 
		function GetCheck()
		{
			if (LED_form.LED1.checked) {
				strLED1 = "&LED1=1";
			}
			else {
				strLED1 = "&LED1=0";
			}
		}
		
		function GetButton1()
		{
			if (LED2_state === 1) {
				LED2_state = 0;
				strLED2 = "&LED2=0";
			}
			else {
				LED2_state = 1;
				strLED2 = "&LED2=1";
			}
		}
		function GetButton2()
		{
			if (LED3_state === 1) {
				LED3_state = 0;
				strLED3 = "&LED3=0";
			}
			else {
				LED3_state = 1;
				strLED3 = "&LED3=1";
			}
		}
		function GetButton3()
		{
			if (LED4_state === 1) {
				LED4_state = 0;
				strLED4 = "&LED4=0";
			}
			else {
				LED4_state = 1;
				strLED4 = "&LED4=1";
			}
		}
		function GetButton4()
		{
			if (LED5_state === 1) {
				LED5_state = 0;
				strLED4 = "&LED5=0";
			}
			else {
				LED5_state = 1;
				strLED4 = "&LED5=1";
			}
		}
	</script>
	<style>
		.IO_box {
			float: left;
			margin: 0 20px 20px 0;
			border: 1px solid blue;
			padding: 0 5px 0 5px;
			width: 120px;
		}
		h1 {
			font-size: 120%;
			color: blue;
			margin: 0 0 10px 0;
		}
		h2 {
			font-size: 85%;
			color: #5734E6;
			margin: 5px 0 5px 0;
		}
		p, form, button {
			font-size: 80%;
			color: #252525;
		}
		.small_text {
			font-size: 70%;
			color: #737373;
		}
	</style>
    </head>
    <body onload="GetArduinoIO()">
        <h1>Remote Control</h1>
		<div class="IO_box">
			<h2>Checkbox</h2>
			<form id="check_LEDs" name="LED_form">
				<input type="checkbox" name="LED1" value="0" onclick="GetCheck()" />LED 1 (D6)


			</form>
		</div>
		<div class="IO_box">
			<h2>Button</h2>
			<button type="button" id="LED2" onclick="GetButton1()">LED 2 is OFF (D7)</button>


			<button type="button" id="LED3" onclick="GetButton2()">LED 3 is OFF</button>


			<button type="button" id="LED4" onclick="GetButton3()">LED 4 is OFF</button>


			<button type="button" id="LED5" onclick="GetButton4()">LED 5 is OFF</button>


		</div>
		
		
    </body>
</html>

Can someone tell me why LEDX is off /on doesnt change?

(deleted)

spycatcher2k: This is NOT an Arduino question. >:(

it is in combination with an arduino code, i can supply the code if you want..

spycatcher2k: This is NOT an Arduino question. >:(

No but it does appear to be an "Interfacing w/ Software on the Computer" question. Thread moved.

What is the file that you have submitted called ? ajax_inputs ? Is it in the root directory of your web server ?
If you are following a tutorial, post a link to that.
Also include the “Arduino” code you spoke about.
That way, maybe you’ll get some help here.

6v6gt: What is the file that you have submitted called ? ajax_inputs ? Is it in the root directory of your web server ? If you are following a tutorial, post a link to that. Also include the "Arduino" code you spoke about. That way, maybe you'll get some help here.

http://pastebin.com/5VPJCjF9

Thanks in advance

PS: Checkbox doesnt work anymore either

Is the file that appears in post #1 called index.html ? Is the code that you posted in pastebin called ajax_inputs (and what is it's extension) html ?) Do you see the following two messages in the serial console: 1) "SUCCESS - SD card initialized." 2) "SUCCESS - Found index.htm file."

You've checked the obvious things like the ip address. MAC address associated with your ethernet card are OK ?

If all that is OK, then maybe you can add some Serial.prints to the file that you have also copied into Pastebin, for example:

if (client) { // got client?
     Serial.println (">>>>>>>>at got client");

and see how far you get.

I suspect it would be much easier to develop web code on a PC and only transfer it to an Arduino when you know it works.

...R

6v6gt: Is the file that appears in post #1 called index.html ? Is the code that you posted in pastebin called ajax_inputs (and what is it's extension) html ?) Do you see the following two messages in the serial console: 1) "SUCCESS - SD card initialized." 2) "SUCCESS - Found index.htm file."

You've checked the obvious things like the ip address. MAC address associated with your ethernet card are OK ?

If all that is OK, then maybe you can add some Serial.prints to the file that you have also copied into Pastebin, for example:

if (client) { // got client?
     Serial.println (">>>>>>>>at got client");

Tried that, but the web page is showing fine but only the button / checkbox status dont work. This is the TUT/code http://startingelectronics.org/articles/arduino/switch-and-web-page-button-LED-control/

and see how far you get.