home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_06.cab / samp6e5v.asp < prev    next >
Text File  |  1997-09-29  |  4KB  |  42 lines

  1.  <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp6e5v.asp&srcfile=Simple/Variables" %>
  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>Variables</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="_variables"></a>Variables</h3>
  30. <p>
  31. Every application ever written, regardless of the programming language, has used variables of some sort, and ASP scripts are no exception. Both VBScript and JScript allow you to create and manage variables simply and easily. </p>
  32. <p>
  33. Each language deals with variable declaration differently. As an acknowledgement that scripters often don't want to get bogged down in strict data typing, both JScript and VBScript are quite flexible about variables and their declaration. In VBScript, any variable is automatically considered to be of the <b>Variant</b> type when it is initially declared with the <b>Dim</b> statement. Each variable eventually is assigned a subtype, such as <b>Numeric</b> and <b>Array</b>, according to what is assigned to them. JScript, likewise, doesn't require much type specificity when the variable is initially declared with the <b>var</b> statement. Both languages, in general, try to make your life easier by performing much of the data type management under the covers, including performing automatic type conversion. In fact, you don't even have to use the <b>Dim</b> or <b>var</b> statements at all to use a new variable; they are optional in their respective languages.</p>
  34. <p>
  35. This sample declares several different kinds of variables, performs simple operations on them, and then displays them to the client browser using the special <% = ...%> script delimiters. An integer is assigned to the variable <i>intVariable</i>, added to itself, and the sum sent to the client browser. <i>StrVariable</i> is set to equal Jemearl, is added to Smith, and sent to the client browser. Booleans and dates are likewise declared or created, initialized, manipulated, and displayed. </p>
  36. <p>
  37. Of particular interest is the final step in the date variable demonstration. In VBScript, the variable is first assigned a literal date string, and displayed. It is then reset, and assigned the value that is returned by the VBScript <b>Now</b> function, which should return the current system time. The JScript example uses the JScript <b>Date</b> function to set both the initial literal by passing parameters to the function, and then to set the variable equal to the current system time by passing no parameters to the function. </p>
  38. <hr class="iis" size="1">
  39. <p align="center"><em><a href="/iishelp/common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
  40. </BODY>
  41. </HTML>
  42.