Web Technologies

Web Technologies 

Slip18

Q.1) Write a PHP script to change Background color of the browser using switch statement according to a day of the week.  [Marks30] 

Solution

slip18.php
<html>
<body>
<?php
$a=date("l");
echo "<b>Today=$a</b>";
switch($a)
{
case "Sunday":
 $bgcolor="green";
break;
case "Monday":
 $bgcolor="blue";
break;
case "Tuesday":
 $bgcolor="pink";
break;
case "Wednesday":
 $bgcolor="lime";
break;
case "Thursday":
 $bgcolor="yellow";
break;
case "Friday":
 $bgcolor="pink";
break;
case "Saturday":
 $bgcolor="purple";
break;
default:
$bgcolor="brown";
}
echo "<body bgcolor=\" $bgcolor\">";
?>
<br><br>
<b>This just change the colour of screen on the day of the week</b>
</body>
</html>

BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

Post a Comment

Previous Post Next Post

DBMS Practical Slips