-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP8.html
More file actions
51 lines (50 loc) · 1.92 KB
/
P8.html
File metadata and controls
51 lines (50 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
// document.getElementById("google").addEventListener("click", function(){
// window.location = "https://www.google.com"
// win.focus();
// })
// const fetchContent = async (url) => {
// con = await fetch(url);
// let a = await con.json()
// return a;
// }
// setInterval(async function() {
// let url = "https://jsonplaceholder.typicode.com/todos/1"
// console.log(await fetchContent(url))
// }, 3000)
function turnOnOff() {
let image = document.getElementById('Image');
if (image.src.match("ONbulb"))
image.src =
"https://media.geeksforgeeks.org/wp-content/uploads/OFFbulb.jpg";
else
image.src =
"https://media.geeksforgeeks.org/wp-content/uploads/ONbulb.jpg";
}
</script>
</head>
<body>
<!-- Q-1 -->
<!-- <button onClick = "alert('Please give me one plate of Chowmein')">Chow</button>
<button onClick = "alert('Please give me one plate of Vadapav')">Vadapav</button>
<button onClick = "alert('Please give me one plate of PaniPuri')">PaniPuri</button> -->
<!-- Q-2 -->
<!-- <h1>BookMarks</h1>
<button id="google">Google</button>
<a href="https://fb.com"><button class="bookmark" id="fb">FaceBook</button></a>
<a href="https://twitter.com"><button class="bookmark" id="twitter">Twitter</button></a> -->
<div class="main">
<img id="Image" onclick="turnOnOff()" src=
"https://media.geeksforgeeks.org/wp-content/uploads/OFFbulb.jpg">
<p>
Click on the bulb to turn it ON and OFF
</p>
</div>
</body>
</html>