Recommended: Use ASP programming to achieve fast search of network content One day I had a sudden idea that if I could immediately call up the information I needed to read every time I went to a website, wouldn't it be very wonderful? Next I want to think about this issue more deeply, sit in a chair and grab a pencil, but don’t know what I’m writing. In this way, I still have
You cannot see the ASP source code by viewing the source code in the browser. You can only see the results output by the ASP file, and those are just pure HTML. This is because the script has been executed on the server before the result is sent back to the browser.
Example:
Write text with ASP
| The following is the quoted content: <html> <body> <% response.write(Hello World!) %> </body> </html> |
Add HTML to text
| The following is the quoted content: <html> <body> <% response.write(<h2>You can use HTML tags to format the text!</h2>) %> <% response.write(<p style='color:#0000ff'>This text is styled with the style attribute!</p>) %> </body> </html> |
Basic ASP syntax rules
Normally, ASP files also contain HTML tags, similar to HTML files. However, ASP files can also contain server-side scripts that are surrounded by <% and %>. The server script is executed on the server side and can contain legal expressions, declarations, or operators.
Write output to the browser
The response.write command is used to write output to the browser. The following example sends a text to the browser: Hello World.
| The following is the quoted content: <html> <body> <% response.write(Hello World!) %> </body> </html> |
There is also a shorthand method for the response.write command. The following example is equivalent to the above example:
| The following is the quoted content: <html> <body> <%=Hello World!%> </body> </html> VBScript |
You can use several scripting languages in ASP. However, the default scripting language is VBScript:
| The following is the quoted content: <html> <body> <% response.write(Hello World!) %> </body> </html> |
The above example also writes the text Hello World! in the body part of the document.
JavaScript
If you need to use JavaScript as the default scripting language for a specific page, you must insert a line of language settings at the top of the page:
| The following is the quoted content: <%@ language=javascript%> <html> <body> <% Response.Write(Hello World!) %> </body> </html> |
Note: Unlike VBScript - JavaScript is case sensitive. So you need to write ASP code using different upper and lowercase letters according to JavaScript's needs.
Other scripting languages
The combination of ASP with VBScript and JScript is native. If you need to write scripts in other languages, such as PERL, REXX, or Python, you must install the corresponding footstep engine.
Important: Because the script is executed on the server side, the browser that displays the ASP file does not need to support scripts at all.
Share: ASP Tips: Rename tables in Access Database The following code is an example code for renaming the Access table name with Adox: The following is the referenced content: Dim Conn,ConnStr,oCat,oTblConnStr = Provider=Microsoft.J