Untitled

 avatar
unknown
plain_text
a year ago
558 B
4
Indexable
15
Computer Multimedia & Animation LAB
10. Write JavaScript Program to show light ON/OFF Demo 
lab10.html
<!DOCTYPE html>
<html>
<head>
<title>ON OFF bulb</title>
</head>
<body>
<script>
function turnonoff() {
var lightBulb=document.getElementById('image');
if(lightBulb.src.match("onbulb"))
lightBulb.src="offbulb.jpg";
else
lightBulb.src="onbulb.jpg";
}
</script>
<center>
<img id="image" align="center" onclick="turnonoff()" src="offbulb.jpg">
</center>
<p align="center">Click on the bulb to turn it ON and OFF</p>
</body>
</html>
Editor is loading...
Leave a Comment