【正文】
eresting example that displayed the current server time, but to be really useful a script needs to perform some form of calculation, or manipulate dynamic information to present it in some interesting way. The language used for writing most ASP programs, and which I39。 that is, you must let ASP know that you want to create a variable with a particular name. Let39。deg。 MySQL Fully updated for PHP . Installation instructions for Mac OS X Full index provided New wider book size Enhanced fonts New cover design Layflat spine All content revisited Download the First 4 Chapters FREE 3 Tell me more about this topselling book. Dim intRoomTempC 39。 Assign the variable a value of 20 The keyword Dim in the above is short for dimension, and is used to tell VBScript to create a variable with the name specified (in this case, intRoomTempC). Why 39。, you ask? I agree, it39。re asking VBScript to do. When creating a variable, VBScript needs to assign some space in memory to store whatever value(s) will be placed in the variable, and part of that task is to figure out the size (dimension) of the space that needs to be allocated. In any case, creating a variable is as simple as typing Dim followed by the name of the variable. The second line of the above example assigns a value to the variable that was just created。ll meet many other operators that do other weird and wonderful things to variables and the values they store. You should always create a variable before assigning it a value, and you39。t exist. Since you are free to use implicit declaration for all of your variables, you may be wondering what the point is of using the Dim mand to create each and every variable by hand. The answer has to do with how easy you want it to be to find typing mistakes in your code. VBScript provides another mand, Option Explicit, which causes ASP to disallow implicit declarations and instead display an error message whenever you try to assign a value to a nonexistent variable. Why would you want this to happen? Consider the following example: 4 Dim intRoomTempC 39。 Assign the variable a value of 20 If you have a keen eye, you may have noticed that the variable name is misspelled on the second line. This is the kind of mistake that even experienced programmers make all the time. With implicit declaration enabled, the second line will create another new variable called intRomTempC and will store the value in that variable instead. Now, if the rest of your script expects that value to be stored in intRoomTempC, you39。s where Option Explicit es in: Option Explicit 39。 Create a variable intRomTempC = 20 39。 Two variables in one line By now you may be wondering about my naming convention for variables. The two variables created in the above snippet both begin with int. I39。ll introduce additional prefixes for 5 other data types as they arise over the course of this series. The Web has grown beyond the point where an online brochure will satisfy a typical pany39。ASP39。ll help you get your feet wet by introducing the VBScript programming language, and how to use it to write dynamic Web pages with ASP. Before I get to that, I shall stop to explain how serverside scripting, and ASP in particular, differs from other Web scripting technologies that you may be familiar with, such as clientside JavaScript. This will get you armed with the proper vocabulary and ensure that we39。ve programmed We b pages in Perl, PHP,