how to change the div background color on every
refresh..guys can u help me out.
Answer Posted / prantik gautam
<?php
$var1=rand(0,9);
$var2=rand(0,9);
$var3=rand(0,9);
$var4=rand(0,9);
$var5=rand(0,9);
$var6=rand(0,9);
$col='#'.$var1.$var2.$var3.$var4.$var5.$var6;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>Change Background Color of DIV</title>
<style type="text/css">
#bk{
width:300px;
height:300px;
background-color:<?php echo $col; ?>;
border:1px solid #000000;
}
</style>
</head>
<body>
<div id="bk">DIV Changing its background</div>
</body>
</html>
| Is This Answer Correct ? | 12 Yes | 4 No |
Post New Answer View All Answers
What is the difference between runtime exception and compile time exception?
What is api laravel?
Does php support multiple inheritances?
Explain the difference between isset() and empty()?
What is basic php?
Which method removes the last element from the end of an array?
What is the best practice for running mysql queries in php? Consider the risk of sql injection.
How to get the ip address of the client?
How to send email using php script?
Are php sessions secure?
Tell me what is the actually used php version?
Where do we use get and post?
What is empty php?
What are constructor and destructor in PHP?
Which php framework is fastest?