html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="buttons">
</div>
<div id="reset">
</div>
</body>
<script>
</script>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
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
window.onload = function() {
const changeColor = button => {
document.body.style.background = event.target.style.background;
};
var body;
body = document.getElementById("buttons");
//Creating Red Button
var redButton = document.createElement("button");
var redText = document.createTextNode("Red");
redButton.appendChild(redText);
body.appendChild(redButton);
body.style.border = "3px solid blue";
redButton.style.margin = "auto";
redButton.style.width = "100%";
redButton.style.color = "red";
var greenButton = document.createElement("button");
var greenText = document.createTextNode("Green");
greenButton.appendChild(greenText);
body.appendChild(greenButton);
greenButton.style.width = "100%";
greenButton.style.color = "green";
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run