Through the first two studies, I believe that you have designed a basic concept and overall impression of the dynamic website design of ASP. From this article, the author will start from the scripting language, lead everyone to explore the true mystery of ASP dynamic website design.
After the second article of this article, many friends have sent me "sisters". I hope to see the third, fourth, or even ... articles in this article as soon as possible, and even have an anxious thing to be anxious to be ASP. Send him. Seeing friends with such a symptom, making me spirit. Although ASP has been launched two years ago, until this year, it took advantage of its flexible and convenient development process, good Web database connection function received a national person, but due to the current domestic still lacking on ASP development web applications. Detailed textbooks, thus make the domestic major web developers are still at the stage of closing E text, as well as author himself. Because of this, the author will send the idea of writing the article. After receiving the strong support of Mr. Weng Bin, the CHINABYTE Network Academy, you can see this article.
The author I can adopt this article to provide convenience to the majority of web developers and enthusiasts, so that everyone will come together to participate in the ASP's learning and communication. In order to take care of the needs of different level readers or decided to start from the most basic scripting language, then Step step by step, an ASP built-in object, ActiveX component, and instance of developing web applications with ASP. I believe that through a period of continuous learning, it is not possible to develop its own dynamic sites in a few months. Let's first ask me to learn about the basics of application scripting languages (mainly VBScript) in ASP.
Before you start learning a scripting language, you should understand some simple concepts - variables, processes. The so-called variable is a named storage location in the computer memory, which contains data such as numbers or strings, which allows users to understand the name of script operations, providing users with a way to store, retrieve, and operation data. The program is composed of one or more processes. In VBScript, the process is "instruction block", and the process in which the process is generally, such as Sub, just for simple data processing.
In VBScript, strict speaking variables do not have to be declared.
Such as: <% mystring = "this is my string"%>
However, even if you don't need to declare the variables before using the variable, it should also be developed in a good habit of declaring variables during programming, as this helps prevent errors. Declaring a variable means telling the script engine, there is a variable of a specific name so that the variable can be referenced in the script. Declaring a variable in VBScript You can use the "DIM" statement, as follows:
Option expedition 'requires all variables in the script
DIM mystring
MyString = "this is my string"
->
script>
The scope of the variable is the life period, which decides which script commands can access the variable. The variables declared in the process have a local scope. Each time a process is performed, the variable is created and done. Any command outside the process cannot access it. The variables outside the process have a global scope that can be accessed and modified by any script commands on the ASP page. When declaring variables, local variables and global variables can have the same name. Alternatively, the value of one will not change the other value. If there is no declaration, you may not carefully change the value of a global variable. For example, the following script command returns a value of 1, although there are two name Y variables:
<%
Dim yy = 1call setlocalvariableresponse.write Ysub SetLocalVariable
DIM Y
Y = 2END SUB%>
Since the variable does not explicitly declare, the following script command will return 2. When the process call sets y to 2, the script engine believes that the process is to modify the global variable:
<%
Y = 1call setlocalvariableresponse.write y
Sub setLocalVariable
Y = 2
End Sub%>
However, global variables are available only in a single ASP page, to make it available in a single ASP page, you must give a session or application scope for variables. The session scope variable is available to all pages in the ASP application requested by the user. The application scope variable is true. For a single user, the session variable is the best way to store information, for example, user preferences, usernames, or user identity. For all users of a special application, the application scope is the best way to store information, such as the initial value required for application-specific greetings or applications. The ASP provides two built-in objects to allow you to store variables: Session objects and Application objects, which will focus on future ASP built-in objects.
Let's take a look at the definition of constants, and constants are used instead of a number or string name, which remains unchanged throughout the script. You can create user-defined constants in VBScript using a const statement. Use the const statement to create a name or numeric constant with a certain meaning of a sense, and give them the original value. E.g:.
Such as: <% const mystring = "This is a constant"%>
<% Const myage = 100%>
Note that the string text is included between two quotes (""). This is the most obvious way to distinguish between character string constants and numerical constants. Date text and time text are included between two wells (#). E.g:
<% Const cutoffdate = # 6-1-97 #%>
After understanding constants and variables, let's take a look at what process. It is a set of scripts that can perform specified tasks and have return values. You can define your own process and then call them repeatedly in the script. You can define the process definition in the .asp file, you can also put the general-purpose process in a shared.asp file, and then use the SSI #InClude instruction to include other .asp files that call it. You can also choose another way to package these features in the ActiveX component. Process definitions can appear in the