、须清楚的几个概念 p1. asp <% if request(send)<>then response. write"你已经输入了用户名和密码!" end if %> (广东学钱术取业学院
二、须清楚的几个概念 p1.asp <% if request("send")<>"" then response.write "你已经输入了用户名和密码!" end if %>
、须清楚的几个概念(续) 2.客户端与服务器端脚本程序( Client/Sever) 在客户端执行的程序,如 pI.htm 在服务器端执行的程序,其生成一个 HTML文件并在客户端被执行,如 pl. asp 可1:是不是存在服务器端的程序,就是 服务器端运行的程序? 问2:将p1asp文件拷到客户端,其是否 可以在IE中直接运行? (广东学钱术取业学院
二、须清楚的几个概念(续) 2. 客户端与服务器端脚本程序(Client/Sever) 在客户端执行的程序,如p1.htm 在服务器端执行的程序,其生成一个 HTML文件并在客户端被执行,如p1.asp 问1:是不是存在服务器端的程序,就是 服务器端运行的程序? 问2:将p1.asp文件拷到客户端,其是否 可以在IE中直接运行?
动态网页的工作原理 接受请求 找到动态网页」 服务器端运行动态网页, 生成静态网页 发送网页 (广东学钱术取业学院
动态网页的工作原理 接受请求 找到动态网页 发送网页 服务器端 运行动态网页, 生成静态网页
、须清楚的几个概念(续) 例子13:ASP的另一种格式 <body> script| anguage=“ Jscript runat= server”> function sayhelloo response. write( hello!) </script> sayhelloo%> </body> 汪 t language=Jscript runat= server>∴.</ script, runat= server说明该脚本程序运行在服务 器端,否则其运行在客户端。结果为helo! 2)服务器端语句只可调用在服务器端定义的函数和子程序,不能调用 客户端定义的函数,反之也成立 (3)如果上述程序中去掉 runat= servel(或 runat=" server"),则程序运行会 出错。 (广东学钱术取业学院
二、须清楚的几个概念(续) • 例子1-3:ASP的另一种格式 <body> <script language=“Jscript” runat=“server”> function sayhello() { response.write(“hello! ”) } </script> <% sayhello() %> </body> 注: (1)程序使用脚本语言,<script language=Jscript runat=server>...</script>, runat=server 说明该脚本程序运行在服务 器端,否则其运行在客户端。结果为 hello! (2)服务器端语句只可调用在服务器端定义的函数和子程序,不能调用 客户端定义的函数,反之也成立。 (3)如果上述程序中去掉runat=server(或runat="server"),则程序运行会 出错
、须清楚的几个概念(续) 例子1-4:ASP的第三种格式 <html> <head> <title>ASP Script示例</tte<head> <body> This is the first sentence <script LANGUAGE="JScriptRUNAT="server"> response. write This is the second sentence. " </script> </body> </htm> 汪 (1)程序运行结果为 This is the second sentence. This is the first sentence (2)服务器端的脚本程序会首先执行,因此才有上面的结果 (3)若将此脚本语句改为<% response. write("…)%>结果会如何? (广东学钱术取业学院
二、须清楚的几个概念(续) • 例子1-4:ASP的第三种格式 <html> <head><title>ASP Script示例</title></head> <body> This is the first sentence <script LANGUAGE="JScript" RUNAT="server"> response.write("This is the second sentence.") </script> </body> </html> 注: (1) 程序运行结果为This is the second sentence.This is the first sentence. (2) 服务器端的脚本程序会首先执行,因此才有上面的结果. (3) 若将此脚本语句改为<% response.write("...") %>结果会如何?