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
How we can declare variable in php?
What is get and post method in php?
Write a program in php to reverse a number?
Explain mixed and callback functions?
I am writing an application in php that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with php?
What is the difference between htmlentities() and htmlspecialchars()?
What is foreach loop in php?
How can you associate a variable with a session?
Tell me what is mean by an associative array?
Write a program in php to print a table of a number?
What are the difference between overloading and overriding in oops?
What are the functions for imap?
What is variable give example?
Tell me what is the difference between characters 34 and x34?
What is the best way to avoid email sent through php getting into the spam folder?