-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.html
More file actions
22 lines (22 loc) · 791 Bytes
/
background.html
File metadata and controls
22 lines (22 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Change Background Color</title>
</head>
<body>
<button onclick="changeBackgroundColor()">Change Background Color</button>
<script>
function changeBackgroundColor() {
var col = prompt("Enter a color to change the background");
if (col) { // Check if the user entered a color
var newWindow = window.open("", "New Page", "width=400, height=400");
newWindow.document.body.style.backgroundColor = col;
document.body.style.backgroundColor = col;
alert(" both backgrounds are Changed ")
}
}
</script>
</body>
</html>