06 HTML -Menu- Buttons HTML record
STYLE THE MENU BUTTONS USING CSS CODE:
PROGRAM:-6
Save:- html_menu_button6.html
<html>
<head>
<title>ON & OFF BULB</title>
<style type="text/css">
body {
padding: 50px;
background: #f2f2f2;
}
h1 {
color: #808080d6;
letter-spacing: 0.2em;
}
#bulbImg {
width: 200px;
margin: 40px;
}
.container {
text-align: center;
}
.container {
box-shadow: 5px 5px 25px 0px rgba(46,61,73,0.2);
padding: 20px;
background: #fff;
border-radius: 0.375rem;
}
#bulb-button {
display: block;
margin-left: auto;
margin-right: auto;
padding: 15px;
box-shadow: 4px 4px 4px 0 rgba(46, 61, 73, 0.13);
border-radius: 0.25rem;
letter-spacing: 0.09375rem;
background: #fff;
}
</style>
<script>
var state = 0;
function changeBulbImage()
{
if (state == 1)
{
document.getElementById("bulbImg").src="images/off.gif";
state = 0;
} else
{
document.getElementById("bulbImg").src="images/on.gif";
state = 1;
}
}
</script>
</head>
<body>
<div class="container">
<img id="bulbImg" src="images/off.gif" alt="Blub">
<button id="bulb-button" type="button" onclick="changeBulbImage()">Bulb ON/OFF</button>
</div>
</body>
</html>
Output:-01
Output:-02


Comments
Post a Comment