multi_button
by bvotcode
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Buttons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<button id='btn1' type="button" onclick="function1()">Turn Blue</button>
<button id='btn2' type="button" onclick="function2()">Turn Red</button>
<button id='btn3' type="button" onclick="function3()">Turn Green</button>
<script>
function function1() {
document.body.style.backgroundColor = 'blue';
}
function function2() {
document.body.style.backgroundColor = 'red';
}
function function3() {
document.body.style.backgroundColor = 'green';
}
</script>
</body>
</html>