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

  1.  <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp5nlf.asp&srcfile=Simple/Arrays" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  3. <HTML>
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
  6. <title>Arrays</title>
  7. <script language="JavaScript">
  8.  
  9.     szNavVersion = navigator.appVersion
  10.  
  11.     if (navigator.appName == "Microsoft Internet Explorer") {
  12.     if (szNavVersion.indexOf ("4.") >= 0) {
  13.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  14.     } else {
  15.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  16.     }
  17.     }
  18.     else if (navigator.appName == "Netscape") {
  19.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  20.     }
  21.     else {
  22.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  23.     }
  24.  
  25. </script>
  26. <META NAME="DESCRIPTION" CONTENT="Internet Information Server reference information"></HEAD>
  27. <BODY BGCOLOR=#FFFFFF TEXT=#000000>
  28. <font face="Verdana, Arial, Helvetica">
  29. <h3><a name="_arrays"></a>Arrays</h3>
  30. <p>
  31. Arrays are essentially variables that can hold more than one value. Both VBScript and JScript support arrays for most data types. This sample demonstrates how you can create and use arrays in ASP scripts.</p>
  32. <p>
  33. Each element of an array is accessed by using an index. Thus, in the array <i>A,</i> <i>A(0)</i> refers to the first element<i>, A(1)</i> refers to the second element, and so on. Note that array elements in both VBScript and JScript are numbered starting at 0.</p>
  34. <p>
  35. Arrays can be fixed-size, or dynamically sizable. In both VBScript and JScript, the variable name must be declared, and storage space must be allocated for a new array. This is accomplished by using the <b>Dim</b> statement in VBScript, and the <b>new</b> statement in JScript. If a specific size is explicitly stated, then the array is fixed-size, but if a specific size is omitted from the declaration, then the array is considered dynamically sizable. </p>
  36. <p>
  37. This sample creates two arrays, <i>aFixed</i>, which is fixed-size, and <i>aColors</i>, which is dynamically sizable. The script then assigns specific string values to each element in the arrays, using the index notation <i>ArrayName</i>(<i>Index</i>) to access the appropriate element. The script then loops through each array using a <b>For</b> loop and displays the results in a table.</p>
  38. <p>
  39. Notice that dynamically sizable arrays are implicitly expanded in JScript, so as to include the highest element indexed in an assignment. VBScript, in contrast, requires that you explicitly resize the dynamic array with the <b>ReDim</b> statement. </p>
  40. <hr class="iis" size="1">
  41. <p align="center"><em><a href="/iishelp/common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
  42. </BODY>
  43. </HTML>
  44.