ASP Basics
Links
1-a: What Do I Need?As you learned in the ASP introduction primer, ASP is a server-side technology which means that the server for your website is the sole controller of whether or not ASP is available to you. ASP is also a product of Microsoft which means it will only run on Microsoft operating systems, however, there is a third party package that will help you get around this problem. We'll talk about that later. |
|
1-b: How Does It Work?Now that you have a platform for running your ASP pages, hopefully, I'll bet you would like to know how the pages are actually processed. Well, it's pretty simple actually. |
|
1-c: Make Your First ASP PageWell, actually you already did. The test page code listed above is a fully functional ASP page. So, let's take a closer look at it and see what it is doing. The first thing you probably noticed were the goofy looking <% and %> tags. Those little guys are ASP's way of telling the server that inside here is some code that needs to be looked at and processed. Also, did you notice that the ASP tags are sprinkled in and amongst the standard HTML that you are already familiar |
|
2-a: The DIM StatementSo, what the heck is a DIM...and what DIM-wit came up with the name? Well, DIM actually stands for dimension and is a hold over from the original BASIC language. What DIM does is let the computer know what variables you are going to use. The computer needs to know what variables you will use in order to reserve some space for them. |
|
2-b: The IF .. THEN StatementAnd now on to bigger and better things, the IF .. THEN statement. This will probably be one of the statements that you use the most in VBScript. The IF .. THEN statement is what is known as a conditional statement. In other words, when some condition is met (or not met for that matter) then something happens. Boiled down to its simplest form, that is programming in a nutshell. It is simply a series of events and responses to those events. |
|
2-c: The CASE StatementNow that you have an idea of how conditional statements work we'll throw out another one to you, the CASE statement. The CASE statement is very much akin to the IF .. THEN. For our example of the CASE statement we're going to give you a practical example. Whenever possible we'll try to give at least one practical example with each segment of our primer series. Here's your practical example for this segment: |
|
3-a: The For .. Next LoopFor those of you that tend to be repetitive, you'll love this installment of the ASP Primer. Using loops we can thumb through data, automatically generate a list of numbers or dates, traverse an array or any number of other things. Let's take a look at the FOR .. NEXT loop first. This particular loop is about as straight-forward as it gets. Its job is to start at a certain number and count until it reaches its designated stopping point. |
|
3-b: The Do .. LoopThe DO .. LOOP is a combination of the IF .. THEN statement and the FOR .. NEXT loop. It's a conditional loop. In other words, it loops repeatedly (like a FOR .. NEXT loop) until some specific criteria is met (like an IF .. THEN statement). |
|
3-c: All About ArraysAnd now for a new way to store information .. arrays. Arrays are a very handy storage method. Think of arrays as variables on steroids. Imagine you wanted to store 20 different people's last names in variables. It would be quite a pain to create and keep track of strLastName1, strLastName2, etc. Not very efficient, right? That's where arrays come in. With an array you can create one variable that will have 20 slots, one for each person's name. Here is how |
|
4-a: Do the MathEven though you probably won't be doing much serious math in most of your ASP applications, it's still a good idea to review some of the more common math functions. Being that as it may, here are the more common VBScript mathematical functions: |
|