Hi Guys,
I want to create a project lighting control system via Web Browser, I was inspired from a project created on the site http://codingowl.com/readblog.php?blogid=154 and http://www.boarduino.web.id/2016/06/kontrol-relay-dengan-arduino-dan_25.html, and I tried to do a combination between the two to generate a Web Server SD Card that can do On / Off to Relay via Buttons I created with HTML and CSS code. I have modified both codes obtained from both sites, but I am NOT a GOOD PROGRAMMER
, so I need code corrections from Master here. I want to make an interface display of the light control system as shown below, if "Red (Off)" button is clicked it will be "Green (On)" button and Device status will be "Off" and vice versa.

Arduino Code https://drive.google.com/file/d/0BxY9ZmKNxMM8bUZWTldFVE5CMDg/view
HTML Code https://drive.google.com/file/d/0BxY9ZmKNxMM8QmlFTDRwdW5oSE0/view
JavaScript Code https://drive.google.com/file/d/0BxY9ZmKNxMM8QW84cm5OU1hiRFE/view
I am unsure of the Arduino and JavaScript code above if it works, because I do not understand that. What can I fix or change from the code?
Please help me, to help me finish my code.