0% found this document useful (0 votes)
9 views

CSS Practical 9

Uploaded by

Piush Gogi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

CSS Practical 9

Uploaded by

Piush Gogi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PRACTICAL NO: 9

Develop a webpage using intrinsic javascript functions.

PROGRAM:

<!DOCTYPE html>
<html>
<head>
<title>Experiment 9</title>

<style>
body
{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
#colorButton
{
top: 50%;
transform: translateY(-50%);
background: rgba(0, 0, 0, 0.5);
color: white;
border: none;
padding: 10px 20px;
cursor: pointer; border-radius: 5px;
font-size: 18px;
font-family: Times New Roman;
}
</style>

</head>

<body>

<h1>Intrinsic Javascript Function</h1><br>


<button id="colorButton"><b>Change Color</b></button>
<script>
const colorButton = document.getElementById("colorButton");
function changeBackgroundColor()
{
const randomColor = "#" + Math.floor(Math.random() *
16777215).toString(16);
document.body.style.backgroundColor = randomColor;
}

colorButton.addEventListener("click", changeBackgroundColor);

setInterval(changeBackgroundColor, 2000);

</script>
</body>
</html>

OUTPUT:

You might also like