Answer Posted / muhammad adeel qureshy
<?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 ? | 12 Yes | 10 No |
Post New Answer View All Answers
What does session start do in php?
Explain the importance of the function htmlentities.
What is pdo classes?
What is the difference between echo, print and printf()?
What is the use of preg_match in php?
What is php artisan serve?
Write a hello world program using variable?
What are the 5 types of data?
How to check if a string contains a character or word in php?
What is the use of dual table in mysql?
Do you know how to get the ip address of the client?
Are php sessions cookies?
What is Apache's configuration file typically called?
What is php written in?
How can you declare a constant variable in php?