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
Explain Creating and Naming an Array?
What are the php functions?
Tell us how can we display the output directly to the browser?
How can we automatically escape incoming data?
What are the differences between GET and POST methods in form submitting?
Explain the difference between $message and $$message?
Explain what does $_files means?
How long should a session last?
What is x+ mode in fopen() used for?
Tell me how to find the position of the first occurrence of a substring in a string?
What is session management php?
What is prepare in php?
How we can get the number of elements in an array?
How do I end a php session?
Explain the difference between $var and $$var?