Put two color name and change background in css and javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Home</title>
</head>
<body id="bg">
<h1>Input color name</h1>
<input type="text" id="in1">
<input type="text" id="in2">
<script>
var x =document.getElementById("in1");
var y =document.getElementById("in2");
var z =document.getElementById("bg");
function ram(){
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Home</title>
</head>
<body id="bg">
<h1>Input color name</h1>
<input type="text" id="in1">
<input type="text" id="in2">
<script>
var x =document.getElementById("in1");
var y =document.getElementById("in2");
var z =document.getElementById("bg");
function ram(){
z.style.background = `linear-gradient(to right, ${x.value} , ${y.value})`;
}
in1.addEventListener('input',ram);
in2.addEventListener('input',ram);
}
in1.addEventListener('input',ram);
in2.addEventListener('input',ram);
</script>
</body>
</html>
</body>
</html>
Comments
Post a Comment