home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / Conditional_JScript.asp < prev    next >
Text File  |  1997-10-25  |  2KB  |  80 lines

  1. <%@ LANGUAGE = JScript %>
  2.  
  3. <HTML>
  4.     <HEAD>
  5.         <TITLE>Conditional Operator Sample</TITLE>
  6.     </HEAD>
  7.  
  8.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  9.  
  10.  
  11.         <!-- Display Header -->
  12.  
  13.         <font size="4" face="Arial, Helvetica">
  14.         <b>Conditional Operator Sample</b></font><br>
  15.       
  16.         <hr size="1" color="#000000">
  17.  
  18.  
  19.         <%
  20.             // Determine Date
  21.  
  22.             var dtmVar = new Date();
  23.         %>
  24.         
  25.         
  26.         <!-- Display Date -->
  27.  
  28.         <P>The date is: <%=dtmVar.getMonth()+1%>/<%=dtmVar.getDate()%>/<%=dtmVar.getYear()%></p>  
  29.  
  30.         <%
  31.             // Switch statement to display a message based on the day of the month
  32.             switch (dtmVar.getDate())
  33.              {
  34.               case 1:
  35.               case 2:
  36.               case 3:
  37.               case 4:
  38.               case 5:
  39.               case 6:
  40.               case 7:
  41.               case 8:
  42.               case 9:
  43.               case 10:
  44.                Response.Write("<P>It's the beginning of the month.</P>");
  45.                break;
  46.               case 11:
  47.               case 12:
  48.               case 13:
  49.               case 14:
  50.               case 15:
  51.               case 16:
  52.               case 17:
  53.               case 18:
  54.               case 19:
  55.               case 20:
  56.                Response.Write("<P>It's the middle of the month.</P>");
  57.                break;
  58.               default:
  59.                 Response.Write("<P>It's the end of the month.</P>");
  60.              }
  61.         %>
  62.  
  63.         <P>The time is: <%=dtmVar.getHours()%>:<%=dtmVar.getMinutes()%>:<%=dtmVar.getSeconds()%></P>
  64.  
  65.         <%
  66.             // Check for AM/PM, and output appropriate message
  67.         
  68.             if (dtmVar.getHours() >= 12)
  69.             {
  70.                 Response.Write("<P>Good Evening</p>");
  71.             }
  72.             else
  73.             {
  74.                 Response.Write("<P>Good Morning</p>");
  75.             }
  76.         %>
  77.  
  78.     </BODY>
  79. </HTML>
  80.