Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How many escape sequences are recognized in single-quoted strings?

870


What are escaping characters?

895


How the values are ordered in an array?

1015


Can we use include ("xyz.php") two times in a php page "index.php"?

971


What is the difference between $name and $$name?

916


How can you make a connection with mysql server using php?

920


How error handling is being handled by php?

1001


What is the purpose of break and continue statement?

922


What is the difference between php traits vs interfaces?

908


What is the use of magic function in php?

920


What is mvc php?

888


Which is incorrect with respect to separating php code and html?

949


Is laravel better than codeigniter?

981


What is php how it works?

955


What the difference between the 'bitwise and' operator and the 'logical and' operator?

913