大卫韦斯特夺冠:谁能帮我看看这段程序里的有关owen1的代码是怎么调用的

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/01 18:42:30
<%
owen1=request("owen1")
owen2=request("owen2"
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="title_left" height="36" align="center"><div align="left"><a href="otype.asp?owen1=<%=owen1%>"><font color="#000000">
  <%=owen1%></font></a></div></td>
</tr>
<%set rsSmallClass=server.CreateObject("adodb.recordset")
rsSmallClass.open "Select * From SmallClass_New Where BigClassName='" & owen1 & "'",conn,1,1
if not(rsSmallClass.bof and rsSmallClass.eof) then
do while not rsSmallClass.eof
%>
<tr onMouseOver="this.bgColor='#FFFFFF';" onMouseOut="this.bgColor='#EFEFEF';" bgColor=#EFEFEF>
<td height="28" ><div align="left"><a href="otype.asp?owen1=<%=owen1%>&owen2=<%=rsSmallClass("SmallClassName")%>">  <%=rsSmallClass("SmallClassName")%></a></div></td>
</tr>
<%
rsSmallClass.movenext
loop
end if
rsSmallClass.close
set rsSmallClass=nothing
%> <tr>
<td class="title_right" height="32">   <img src="Images/smallbook.jpg" width="10" height="10">  <a href="index.asp">首页</a>>><a href="otype.asp?owen1=<%=owen1%>"><%=owen1%></a></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
if owen1<>"" and owen2 <>"" then
sql="select * from news where BigClassName='"&owen1&"' and SmallClassName='"&owen2&"' order by id desc"
rs.Open sql,conn,1,1
elseif owen1<>"" then
sql="select * from news where BigClassName='"&owen1&"' order by id desc"
rs.Open sql,conn,1,1
end if
if rs.eof and rs.bof then
response.Write("暂时没有记录")
else <tr>
<td width="6%" height="24" align="center" >◎</td>
<td height="24" style="BORDER-bottom: #999999 1px dotted">
<% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %> <a href="shownews.asp?id=<%= RS("id") %>" target="_blank"><%= RS("TITLE") %></a> <font color="#999999">[<%= RS("infotime") %>] (阅读<font color="#ff0000"><%= RS("hits") %><
<tr valign="bottom">
<td height="50" colspan="2" align="center" > <form method=Post action="otype.asp?owen1=<%=owen1%>&owen2=<%=owen2%>">
<%if Page<2 then
response.write "首页 上一页 "

%>

</body>

就是有关a href="otype.asp?owen1=<%=owen1%>">是怎么用的,owen1我也不知道怎么应用的,不太清楚请明白的给我看看,先谢谢了。

给你讲讲这个你也许就明白了,是概念问题
Request从几个集合取数据是有顺序的,从前到后的顺序依次是 QueryString,Form,最后是ServerVariables。Request对象按照这样的顺序依次搜索这几个集合中的变量,如果有符合的就中止,后面的就不管了。

现在我们来分析下你得问题.
假设有个页面 test.asp?id=111
这里我们的页面是用GET的方法.这时用request.querystring("id")与request("id")是一样得,应该如果不指定REQUEST得集合,首先就会从Querystring搜索.

而如果我们的页面是用的是POST的方法发送数据给test.asp,那么用request.querystring("id")是不行的了(他只能取GET),而要用request.from("id"),而如果还用request("id")他也能取到数据,但先检测QUERYSTRING的值,显然速度就慢了.

下面是个检测的例子你可以看看:
<%
If Request("submit")<>"" then
Response.Write "直接取:"& Request("username") & "<br>"
Response.Write "取Get:" & Request.QueryString("username") & "<br>"
Response.Write "取Post:" & Request.Form("username") & "<br>"
End if
%>
<form name=form1 action="" method=post>
<input type=test name="username" value="postuser">
<input type=submit name="submit" value="test">
</form>