教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp  >  正文 asp入门教程:ASP基本语法

asp入门教程:ASP基本语法

发布时间:2016-10-08   编辑:jiaochengji.com
教程集为您提供asp入门教程:ASP基本语法等资源,欢迎您收藏本站,我们将为您提供最新的asp入门教程:ASP基本语法资源

您无法查看的ASP源代码选择“查看源文件”在浏览器中,您将只能看到的输出ASP文件,这是纯HTML 。这是因为脚本的执行服务器上的结果之前,发送回浏览器。

在我们的ASP教程,每一个例子显示了隐藏的ASP源代码。这将使您更容易了解其运作方式

<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>
输出结果为.

You can use HTML tags to format the text!
This text is styled with the style attribute!

基本语法规则
一个ASP文件通常包含HTML标记,就像一个HTML文件。然而, ASP文件还可以包含服务器脚本,四周分隔“ %和% ” 。服务器脚本的执行服务器上,并可以包含任何表情,报表,程序,或经营者有效的脚本语言你喜欢使用。

收件输出到浏览器
该response.write命令是用来撰写输出到浏览器。下面的例子发送的文字的“ Hello World ”浏览器:

<pre><html> <body> <span class="red"><% response.write("Hello World!") %></span> </body> </html></pre> <pre>

还有一种速记法response.write命令。下面的例子还发送的文字的“ Hello World ”浏览器:

 

<pre><html> <body> <span class="red"><%="Hello World!"%></span> </body> </html></pre> <pre> </pre> <pre>

vbscript
您可以使用多种脚本语言在ASP 。然而,默认脚本语言的VBScript :

<table class="ex" cellspacing="0" width="100%" border="1"><tbody><tr><td><pre><html> <body> <span class="red"><% response.write("Hello World!") %></span> </body> </html></pre> </td> </tr> </tbody> </table>

 

上面的例子写的“ Hello World ! ”进入人体的文件。


-------------------------------------------------- ------------------------------

JavaScript的
要设置的JavaScript作为默认的脚本语言为特定的页面上,您必须插入一个语言规范上方的网页:

 

<pre><%@ language="javascript"%> <html> <body> <span class="red"><% Response.Write("Hello World!") %></span> </body> </html></pre> <pre> </pre> <pre>

注:不同的语言-J avaScript是区分大小写。您将有写你的ASP代码与大写字母和小写字母的语言时,需要它。




其他脚本语言
ASP是随VBScript和JScript (微软的执行的JavaScript ) 。如果你想在另一个脚本语言,如Perl中, REXX ,或Python ,则必须安装脚本引擎他们。

重要提示:由于执行脚本在服务器上,浏览器显示ASP文件并不需要支持所有脚本!

 

转载请注明来自www.jiaochengji.com

</pre>
</pre>
</pre>

您可能感兴趣的文章:
asp基础语法
ASP 全新接触(1)
asp入门教程:ASP Request 简单介绍
人文的ASP开发基础入门之简介
ASP教程之ASP基础简介
asp简单还是php简单
asp入门教程:ASP基本语法
php和asp语法上的区别是什么
asp入门教程:asp if else 教程
ASP 中文教程(一)--asp 简介、安装、以及如何显示中文

[关闭]
~ ~