<html>
<head>
<style>
.on{
width:100px;
height:50px;
border-radious:12px;
background-color: green;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
text-align:center;
}
</style>
}
</head>
<body>
<h2>What Can JavaScript Do?</h2>
<h3> Author : Mangulu patra </h3>
<p>JavaScript can change HTML attribute values.</p>
<p>In this case JavaScript changes the value of the src (source) attribute of an image.</p>
<img id="myImage" src="pic_bulboff.gif" style="width:100px">
<button class="on" onclick="Runbulb()">Button</button>
<script>
var ison=false;
function Runbulb(){
if(ison==true)
{
document.getElementById('myImage').src='pic_bulboff.gif';
ison=false;
}
else{
document.getElementById('myImage').src='pic_bulbon.gif';
ison=true;
}
}
</script>
</body>
</html>
RUN CODE
No comments:
Post a Comment