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;
echo '<script type="text/javascript">alert("The color code
'.$col.' had been poped up by using javascript which is used
in PHP");</script>';
?>
<!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 ? | 18 Yes | 8 No |
Post New Answer View All Answers
How do you parse and process html/xml in php?
How to set session.gc_maxlifetime properly?
How to do single and multi line comment in php?
How to create an empty array in php?
How to create and destroy cookies in php?
What is php.ini & .htacess file?
Explain php explode() function.
What is the expansion of LAMP?
What language is php written in?
How do you check if an arraylist is empty?
What are the methods to submit form in php?
How to remove the new line character from the end of a text line?
Where are php configuration settings stored?
Is not null in php?
What is encapsulation in php with example?