Categories
Uncategorized

test code 1

<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<meta name=”viewport” content=”width=device-width”>
<title>JS Bin</title>
<style id=”jsbin-css”>
#a{
background: rgb(0,0,0);
height: 100vh;
width: 100vw;
}
#btn1{
padding: 15px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50% -50%);
cursor: pointer;
}
</style>
</head>
<body>
<div id=”a”>
<button id=”btn1″>Change Color</button>
</div>
<script id=”jsbin-javascript”>
let a = document.querySelector(“#a”);
let btn = document.querySelector(“#btn1”);
btn.addEventListener(“click”,function(){
let v1 = Math.round(Math.random()*255);
let v2 = Math.round(Math.random()*255);
let v3 = Math.round(Math.random()*255);
a.style.background =`rgb(${v1},${v2},${v3})`;
})
</script>
<script id=”jsbin-source-css” type=”text/css”>#a{
background: rgb(0,0,0);
height: 100vh;
width: 100vw;
}
#btn1{
padding: 15px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50% -50%);
cursor: pointer;
}</script>
<script id=”jsbin-source-javascript” type=”text/javascript”>let a = document.querySelector(“#a”);
let btn = document.querySelector(“#btn1”);
btn.addEventListener(“click”,function(){
let v1 = Math.round(Math.random()*255);
let v2 = Math.round(Math.random()*255);
let v3 = Math.round(Math.random()*255);
a.style.background =`rgb(${v1},${v2},${v3})`;
})
</script></body>

</html>

Leave a Reply

Your email address will not be published. Required fields are marked *