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
What is difference Between PHP 5 and 7?
How is it possible to know the number of rows returned in result set?
How to return ascii value of character in php?
What is php and features of php?
What is difference between print_r and echo in php?
What is difference between mysql_fetch_array and mysql_fetch_assoc?
How to turn on the session support in php?
Applications written to provide a GUI shell for Unix and Linux are called
What is a definer in mysql?
hello all, I need some sample placement papers in lion bridge.. can anyone help me?
What is default session time and path in PHP. How to change it?
What is the difference between htmlentities() and htmlspecialchars()?
Why triggers are used in mysql?
How is it possible to know the number of rows returned in the result set?
What is the use of mysql_fetch_assoc in php?