You cannot view the ASP source code Select "View Source file" in the browser, you will only see the output of ASP files, which are pure HTML. This is because the script executes the results on the server before it is sent back to the browser.
In our ASP tutorials, each example shows the hidden ASP source code. This will make it easier for you to understand how it works
<body>
<%
Response.Write ("%>
<%
Response.Write ("<p style= ' color: #0000ff ' >this text is styled with the style attribute!</p>")
%>
</body>
The output result is.
can use HTML tags to format the text!
This text was styled with the style attribute!
Basic grammar Rules
An ASP file usually contains HTML tags, just like an HTML file. However, ASP files can also contain server scripts, separating "% and%" around them. Server scripts are executed on the server and can contain any expressions, reports, programs, or operators that are valid scripting languages you like to use.
Inbox output to Browser
The Response.Write command is used to compose output to the browser. The following example sends the text of the "Hello World" browser:
<%
Response.Write ("Hello world!")
%>
</body>
There is also a shorthand method Response.Write order. The following example also sends the text of the "Hello World" browser:
<%= "Hello world!" %>
</body>
VBScript
You can use a variety of scripting languages in ASP. However, the default scripting language for VBScript:
<%
Response.Write ("Hello world!")
%>
</body>
|
--------------------------------------------------------------------------------
JavaScript
to set JavaScript as the default scripting language for a specific page, you must insert a page above the language specification:
<%@ language= "javascript"%> <% Response.Write ("Hello World
!") %> </body>
Note: Different languages -j Avascript is case-sensitive. You will have to write your ASP code with uppercase and lowercase letters in the language when you need it. The
Other scripting languages
ASP is JavaScript and JScript (Microsoft's execution). If you want to be in another scripting language, such as Perl, REXX, or Python, you must install the scripting engine for them.
Important: Because executing scripts are on the server, browsers do not need to support all scripts to display ASP files!
Reprint please indicate from www.111cn.net