bulb on/off
Bulb Turn On and Turn Off
Ridhi-Sidhi
<!DOCTYPE html>
<html>
<head>
<title>Bulb Turn On and Turn Off</title>
</head>
<body>
<p> Ridhi-Sidhi</p>
<img src="bulboff.png" height ="80" width="55" id="img1">
<script>
function bulbon() {
document.getElementById("img1").src = "bulbon.png";
}
function bulboff() {
document.getElementById("img1").src = "bulboff.png";
}
</script>
<button type="button" onclick="bulbon()">Turn On Light</button>
<button type="button" onclick="bulboff()">Turn Off Light</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Mouseover Mouseout</title>
</head>
<body>
<script>
function big_image(x) {
x.style.width = "300px";
x.style.height = "500px";
}
function small_image(x) {
x.style.width = "50px";
x.style.height = "80px";
}
</script>
<img src="bulbon.png" height="80" width="50" onmouseover="big_image(this)" onmouseout="small_image(this)">
</body>
</html>
even/odd
<!DOCTYPE html>
<html>
<head>
<title>Even or Odd Number Check</title>
<script>
function checkEvenOdd() {
var num = prompt("Enter a number:");
if (num % 2 == 0) {
document.write(num + " is even.");
} else {
document.write(num + " is odd.");
}
}
</script>
</head>
<body onload="checkEvenOdd()">
</body>
</html>
<!---onload Attribute:
mouseover