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
westdhAsked:
Who is Participating?
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.