The code for the Project of bulb switcing ON/OFF is given below :-
<!--
Author : Ajay Kumar Shukla
Purpose : Project of bulb on/off .
-->
<html>
<head>
<title>Bulb project by ajay shukla</title>
<style type="text/css">
button
{
height: 85px;
width: 135;
font-size: 23;
cursor: pointer;
margin: 75;
background-color: blueviolet;
}
</style>
<script type="text/javascript">
function light(value)
{
var img;
if(value==0)
{
img="off bulb.png"
}
else
{
img="on bulb.png"
}
document.getElementById('bulb').src=img
}
</script>
</head>
<body>
<center>
<img src="off bulb.png" id="bulb">
<br>
<Button onclick="light(1)">ON</Button>
<Button onclick="light(0)">OFF</Button>
</center>
</body>
</html>
No comments:
Post a Comment