Recommended: Create a simple chat room with ASP After a stage of Asp learning, we will build a simplest chat room based on the content we have learned. Although it is very simple, you can master the basic process of establishing a chat room through it and continuously improve its functions. The main steps are described below:
1. Page design part1.img control
alt: All display images must have text descriptions that can briefly describe the content of the image.
2.Input control
maxlength: All INPUT controls need to formulate the maxlength attribute, and the default value is the length of the corresponding field in the database.
readonly: All unchangeable information must be used with the readonly attribute.
3.Form control
action: All Form must specify an action, if submitted to itself, specify an action=
method: Use POST to perform irreversible actions, use GET to perform reversible actions
onsubmit: All forms must specify the checking procedures required before submission.
All forms must have corresponding reset buttons.
4. Button control
onclick: The button used for submission in form does not allow this method, and all data checks are activated through the form's onsubmit.
5.title attribute
All pages must have the same title as this page's title.
6. Naming of controls
The method of using control type abbreviation (lowercase) English words (first letter capitalization).
The following categories of controls are basically involved in development
button: btn
form: frm
select:sel
textarea: txt
input:ipt
7. Language settings
All Chinese pages must be added with the following statement:
<meta http-equiv=Content-Language content=en-cn>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
8. Control attribute assignment
The attribute values of all controls must be included in double quotes or single quotes.
2. Client program part
1. Processing of error message (2-1)
All error messages are used in Chinese to prompt error messages, and punctuation uses Chinese half-corner symbols, and the format is as follows:
Error: Prompt message!
2. Processing of successful prompt information (2-2)
All successful information is used in Chinese to prompt success information, and punctuation uses Chinese half-corner symbols, and the format is as follows:
Success: Prompt message!
3. Return of the page
All you need to return to the previous page use history.back(); do not use history.go(-1);
Use history.go(-n) when you need to return to the previous n page (n>1);
All return uses the connection method instead of the button.
4. Judgment of data before submission
Ensure that the data before submission will be judged through JavaScript on the data type and length
Is it a number: Use the function isNaN()
Length judgment: The length should be judged as the actual length after removing the front and back spaces
Empty judgment: All input fields that are not allowed to be empty must be judged after removing the front and rear spaces. At the same time, if the field is a query condition, it must not be empty.
If the judgment condition finds data errors, the error message is prompted through (2-1), and then the error field is focused through the method focus().
5. Tips before deleting data
All operations involving deletion must be confirmed again after the user selects it.
3. Server-side program part
1. Acquisition of data
Through Get and Post, the data passed through the connection must be removed through trim before and after the data before use.
2. Data judgment
The parameter data obtained through request needs to be judged again of null, type, and length.
3. Object closing
All database and file objects should be closed as early as possible after use, and nothing should be assigned at the same time.
4. Prompt information
All error prompts are prompted by JavaScript to ensure that users cannot see any internal error information. (such as 1-1)
If the operations involving database Update, Del, and Insert are successful, you must be prompted. (such as 1-2)
5. Use of variables
All variables need to be declared before use and initial values are assigned.
6. Naming of variables
The method of using variable type abbreviation (lowercase) English words (first letter capitalization).
The following categories of variables are basically involved in development
Integer: i
Decimal: f
Characters: s
Boolean:b
Date: d
Special:
The cycle adopts i, j, m, n in turn;
Arrays with ary
Pointer p, q
Temporary variable tmp
Seven.SQL statements
1. Sort
When ordering, try to use index or primary key field sorting as early as possible.
2.select
Avoid using * when selecting. Even if all fields are required, try to list them one by one in the order they are used.
3. Try to avoid using in and not in
8. Test
All pages must be run at two resolutions: 800*600, 1024*768.
All pages are to run under IE5.0, 5.5 and 6.0 through no JavaScript errors.
Share: What to do if the database is restricted? I don't know if you have encountered such a space. It limits the size of your database. For example, ACCESS MYSQL is limited to less than 100M. If you feel that this space is very affordable, but the database is limited and you want to use such space. Do it, because I encountered it myself