I Want To Turn On Or Off The Bulb By Clicking - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › I Want To Turn On Or Off The Bulb By Clicking (1867 Views)
| I Want To Turn On Or Off The Bulb By Clicking by melodyafsana(op): 9:25am On May 18, 2016 |
<img id="myImage" onclick="changeImage()" src="pic_bulboff.gif" width="100px" height="180px"/> <p>Click the light bulb to turn on/off the light.</p> <script> function changeImage() { var image = document.getElementById('myImage'); if (image.src.match("bulbon" ) {image.src = "pic_bulboff.gif"; }else {image.src = "pic_bulboff.gif"; } } </script> What is the problem with this codex. I want to turn on or off the light but it's just staying on. Lost my control!! too much annoying programming! ![]()
|
| Re: I Want To Turn On Or Off The Bulb By Clicking by jemype(m): 9:30am On May 18, 2016 |
melodyafsana:bro seems the fuse has blown |
| Re: I Want To Turn On Or Off The Bulb By Clicking by melodyafsana(op): 9:35am On May 18, 2016 |
ok resolved. I had just an turn on image other was missing. So have to keep both turn on & off images. Thanks to nairaland helpful community! ] |
| Re: I Want To Turn On Or Off The Bulb By Clicking by DavidTheGeek: 11:08pm On May 18, 2016 |
jemype:LMAO not fair!! |
| Re: I Want To Turn On Or Off The Bulb By Clicking by jemype(m): 7:00am On May 19, 2016 |
DavidTheGeek: theres always a comical side to life |
Follow A Topic By Clicking On The "Follow" Icon. • Control Your Room Light Bulb Over The Internet Using A Smart Phone • How To Turn One Topic Into Six Blog Posts • 2 • 3 • 4
Calculate Your Future Wealth With Python • The Decision Point To Switch Career To Tech And The Second Thought • Application Of Sim Hosting | Sme Data | Vtu | Bulksms | Otp | Vote | Chat
) {image.src = "pic_bulboff.gif"; }
]