当前位置:首页 > 开发教程 > js/jQuery教程 >

A General Overview

时间:2013-04-25 10:59 来源:网络整理 作者:采集侠 收藏

A General OverviewBefore We Start: ASP stands for Active Server Pages. ASP comes from Microsoft and it promises a language neutral platform on which t

  A General Overview

Before We Start:

ASP stands for Active Server Pages. ASP comes from Microsoft and it promises a language neutral platform on which to develop dynamic web pages.

Your Scripts are written as plain text and stored in files with the .asp extension. When called upon, your script goes through the ASP script engine, which combines your scripts with information from the web surfer, possibly a database, and other sources as you see appropriate.

Based on the presumptions laid out on the home page, I assume you already know how to create text files with an .asp extension. I also assume you already know how to place your files into a virtual folder. There is a lot of documentation on how to do these things, but the subject matter is beyond the scope of this web site.

Get Started:

The best way to get into this lesson is simply to dive right into the script.

Below is the ASP Script for Lesson 01.

<%@LANGUAGE="JavaScript"%> <% Response.Write("<HTML>") Response.Write("<BODY>") Response.Write("Hello World<BR>") Response.Write("</BODY>") Response.Write("</HTML>") %>

to run the script in a new window.

Tags:

This is a pretty simple example. My bet is that you already get it. Have you noticed that ASP tags are similar to HTML tags There is a difference. <%ASP Goes Here.%> The ASP tags use a percent sign.

@LANGUAGE:

The @LANGUAGE attribute is set to "JavaScript". That means ASP will run our scripts through the JavaScript (JScript) script engine.

Most servers are set by default to use VBScript. We can change the default language for a single page by using the @LANGUAGE attribute. @LANGUAGE must be set BEFORE any other ASP commands. So, it's a good idea to put @LANGUAGE right at the very top, even before your HTML headers. @LANGUAGE can only be set ONCE in any particular script. It should also stand alone; don't put any other command inside the same set of tags.

Misc. Notes:

Response is an ASP object (Not to be confused with JavaScript objects) and Write is an ASP method (not to be confused with JavaScript methods). Response gets its own lesson later on.

The last thing we need to notice on this script is the difference between the ASP script and the resulting HTML Script.

Below is the HTML source code as seen on the client side.

<HTML><BODY>Hello World<BR></BODY></HTML>

The Client Side output is all on one line. If you haven't already, click the link to run the script and then View Source Code. You will see that the entire HTML text is one unbroken line. That's bad. On lager pages, it will make the HTML output difficult to read. Trust me; you can't find bugs if you can't even make heads or tails of what you're putting out to the client.

In Lesson 02 we will fix that problem.


js/jQuery教程阅读排行

最新文章