程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> ASP入門教程 >> Response對象3

Response對象3

編輯:ASP入門教程
Response對象可以決定接下來向浏覽器發送什麼頁面。這就是response.redirect的
功用所在。我們創建了一個代碼文件script formjump.ASP來演示這種方法

<Html><head>
<TITLE>FormJump.ASP</TITLE>
</head><body bgcolor="#FFFFFF">
<form action="FormJumPRespond.ASP" method="get">
<SELECT NAME="wheretogo">
<OPTION SELECTED VALUE="fun">Fun</OPTION>
<OPTION value="news">Daily News</OPTION>
<OPTION value="docs">ASP IIS3 Roadmap/Docs</OPTION>
<OPTION value="main">MainPage of ActiveServerPages.com</OPTION>
<OPTION value="sample">IIS 3 Sample ASP scripts</OPTION>
</SELECT>
<input type=submit value="Choose Destination">
</form>
</body></Html>

表單的反饋如下: 

<%response.buffer=true%>
<Html><head>
<title>formjumprespond.ASP</title>&
<body bgcolor="#FFFFFF">
<%
' My ASP program that redirects to URL
thisURL="http://www.activeserverpages.com"
where=Request.QueryString("Wheretogo")
Select Case where
case "main"
      response.redirect thisURL & "/"
case "samples"
      response.redirect thisURL & "/ASPsamp/samples/samples.htm"
case "docs"
      response.redirect thisURL & "/iasdocs/aspdocs/roadmap.ASP"
case "news"
      response.redirect "http://www.cnn.com"
case "fun"
      response.redirect "http://www.dilbert.com"
End Select
response.write "All dressed up and I don't know where to go<br>"
response.write "I recommend --> " & "<br>"
response.write server.Htmlencode(thisURL & "/learn/test/res2.ASP?
where=fun") & "<br>"
response.write "for a good laugh!" & "<P>"
%>
</body></Html>
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved