Skip to content

Commit

Permalink
ASSIGNMENT DAY - 5
Browse files Browse the repository at this point in the history
Background color changer using JavaScript.
  • Loading branch information
srinjoy-26 authored Jan 29, 2022
1 parent 536ff19 commit 6a04096
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mynew.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Change background color via text</h1>

<input type="text" id="mycolor">
<input type="button" value="click to change color"
onclick="changeColor()">

<script>
function changeColor(){
var color = document.getElementById('mycolor').value;
document.body.style.backgroundColor = color;
}
</script>
</body>
</html>

0 comments on commit 6a04096

Please sign in to comment.