• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

I would like to know how to change style sheets based on the four seasons..date

I would like to know how to change style sheets based on the four seasons..date
0
westdh
Asked:
westdh
  • 2
  • 2
1 Solution
 
Cornelia YoderArtistCommented:
<?
if ($season == "summer")
   echo '<link rel="stylesheet" type="text/css" href="summer.css" />';
elseif ($season == "spring")
   echo '<link rel="stylesheet" type="text/css" href="spring.css" />';
elseif ($season == "fall")
   echo '<link rel="stylesheet" type="text/css" href="fall.css" />';
elseif ($season == "winter")
   echo '<link rel="stylesheet" type="text/css" href="winter.css" />';
0
 
Cornelia YoderArtistCommented:
Or, of course, you could do a similar thing with a php CASE structure.

<?php
switch($season)
   {
   case "summer" :
     echo '<link rel="stylesheet" type="text/css" href="summer.css" />';
      break;
   case "winter" :
     echo '<link rel="stylesheet" type="text/css" href="winter.css" />';
      break;
   case "fall" :
     echo '<link rel="stylesheet" type="text/css" href="fall.css" />';
      break;
   case "spring" :
     echo '<link rel="stylesheet" type="text/css" href="spring.css" />';
      break;
   default :
     echo '<link rel="stylesheet" type="text/css" href="summer.css" />';
      break;
   }
?>

0
 
westdhAuthor Commented:
why is this not working

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <script type="text/javascript">

    function getSeason() {
    alert("hello")
    month = Date.getMonth();

    season = '';
    switch(month) {
        case '12':
        case '1':
        case '2':
            season = 'winter';
        break;
        case '3':
        case '4':
        case '5':
            season = 'spring';
        break;
        case '6':
        case '7':
        case '8':
            season = 'summer';
        break;
        case '9':
        case '10':
        case '11':
            season = 'fall';
        break;
    }
    alert(season);
}

    </script>
</head>
  <body onload="getSeason()">

</body>
</html>
0
 
westdhAuthor Commented:
Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now