Professional Documents
Culture Documents
Assignment - 1,2
Assignment - 1,2
<!DOCTYPE html>
<html>
<head>
<style>
button {
font-size: 16px;
cursor: pointer;
.btn1 {
background-color: red;
color: white;
.btn2 {
background-color: green;
color: white;
.btn3 {
background-color: blue;
color: white;
</style>
</head>
<body>
<br><br>
function rotateClockwise() {
btn1.className = btn3.className;
btn3.className = btn2.className;
btn2.className = tempClass;
function rotateCounterClockwise() {
btn1.className = btn2.className;
btn2.className = btn3.className;
btn3.className = tempClass;
</script>
</body>
</html>
Assignment-1
HTML CODE-
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h3>Assignment -1 </h3>
<button id="redButton">Red</button>
<button id="greenButton">Green</button>
<button id="yellowButton">Yellow</button>
<script src="script.js"></script>
</body>
</html>
CSS CODE-
html {
height: 100%;
width: 100%;
}
JS CODE-
document.getElementById("redButton").addEventListener("click", function() {
changeColor("red");
});
document.getElementById("greenButton").addEventListener("click", function() {
changeColor("green");
});
document.getElementById("yellowButton").addEventListener("click", function() {
changeColor("yellow");
});
function changeColor(color) {
buttons[i].style.backgroundColor = color;