home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_07.cab / Arrays_VBScript.asp < prev    next >
Text File  |  1998-04-27  |  3KB  |  109 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <%
  3.     ' Declare a simple fixed size array
  4.     Dim aFixed(4)
  5.  
  6.     ' Declare a dynamic (resizable) array
  7.     Dim aColors()
  8.  
  9.  
  10.     ' Assign values to fixed size array
  11.  
  12.     aFixed(0) = "Fixed"
  13.     aFixed(1) = "Size"
  14.     aFixed(2) = "Array"
  15.     aFixed(3) = "Session ID: " & Session.SessionID
  16.  
  17.  
  18.     ' Allocate storage for the array
  19.     Redim aColors(14)
  20.  
  21.     ' Store values representing a simple color table
  22.     ' to each of the elements
  23.  
  24.     aColors(0) = "RED" ' [#FF0000]
  25.     aColors(1) = "GREEN" ' [#008000]
  26.     aColors(2) = "BLUE" ' [#0000FF]
  27.     aColors(3) = "AQUA" ' [#00FFFF]
  28.     aColors(4) = "YELLOW" ' [#FFFF00]
  29.     aColors(5) = "FUCHSIA" ' [#FF00FF]
  30.     aColors(6) = "GRAY" ' [#808080]
  31.     aColors(7) = "LIME" ' [#00FF00]
  32.     aColors(8) = "MAROON" ' [#800000]
  33.     aColors(9) = "NAVY" ' [#000080]
  34.     aColors(10) = "OLIVE" ' [#808000]
  35.     aColors(11) = "PURPLE" ' [#800080]
  36.     aColors(12) = "SILVER" ' [#C0C0C0]
  37.     aColors(13) = "TEAL" ' [#008080]
  38. %>
  39.  
  40. <HTML>
  41.     <HEAD>
  42.         <TITLE>Array Sample</TITLE>
  43.     </HEAD>
  44.  
  45.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  46.  
  47.         <!-- Display Header -->
  48.  
  49.         <FONT SIZE="4" FACE="Arial, Helvetica">
  50.         <B>Array Sample</B></FONT><BR>
  51.       
  52.         <HR SIZE="1" COLOR="#000000">
  53.  
  54.         <TABLE CELLPADDING=10 BORDER=1 CELLSPACING=0>
  55.             <TR>
  56.                 <TD BGCOLOR=WHITE>
  57.                     <FONT SIZE="3" FACE="Arial, Helvetica">
  58.                         <B>A Resizable Array</B><br>
  59.                     </FONT>
  60.                 </TD>
  61.  
  62.                 <TD BGCOLOR=WHITE>
  63.                     <FONT SIZE="3" FACE="Arial, Helvetica">
  64.                         <B>A Fixed Size (4 element) Array</B><BR>
  65.                     </FONT>
  66.                 </TD>
  67.             </TR>
  68.  
  69.             <TR>                
  70.                 <TD>
  71.                     <%
  72.                         ' Calculate Array Size
  73.  
  74.                         nColors = UBound(aColors)
  75.  
  76.  
  77.                         ' Print out contents of resizable array into
  78.                         ' table column
  79.  
  80.                         For i = 0 To nColors - 1
  81.                         
  82.                             Response.Write("<FONT COLOR=" & Chr(34) & aColors(i) & Chr(34) &">" & aColors(i) &"<br></FONT>")
  83.  
  84.                         Next
  85.                     %>
  86.                 </TD>
  87.  
  88.                 <TD>
  89.                     <%
  90.                         ' Calculate Array Size                        
  91.                         
  92.                         nColors = UBound(aFixed)
  93.  
  94.  
  95.                         ' Print out contents of fixed array into table
  96.                         ' column
  97.  
  98.                         For i = 0 To nColors -1
  99.                         
  100.                             Response.Write(aFixed(i) & "<br>")
  101.  
  102.                         Next 
  103.                     %>
  104.                 </TD>
  105.             </TR>
  106.         </TABLE>
  107.     </BODY>
  108. </HTML>
  109.