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 php programming used for?
How to call a php function from html button?
What are hooks in php?
What is the function mysql_pconnect() usefull for?
What is the use of offset in mysql?
Tell me are parent constructors called implicitly inside a class constructor?
How to replace a substring in a given string in php?
Is ruby on rails php?
What is csrf cookie?
What are headers in php?
What is difference between session_unset and session_destroy?
How to get complete current page url in php?
What is overloading and overriding in php?
How are cookies created?
what is benefit of magento?