|
表名 nyxx
字段 id , pid , qid , title , content
联动页面 menu.asp 代码如下:
<!--#include file="conn.asp"-->
<script language="JavaScript">
sall=new Array();
<%
dim i
i=0
set rs=server.CreateObject("adodb.recordset")
sql="select * from nyxx where pid<>0 and id in(Select max(id) from nyxx group by qid) and id in(Select max(id) from nyxx group by qid)"
rs.open sql,conn,1,1
if not rs.eof then
do until rs.eof
%>
sall[<%=i%>]=new Array("<%=rs("pid")%>","<%=rs("id")%>","<%=rs("qid")%>");
<%
i=i+1
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
function changeselect(selvalue)
{
document.all.xl.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][0]==selvalue)
{
var newOption1=new Option(sall[i][2],sall[i][1]);
document.all.xl.add(newOption1);
}
}
}
</script>
<form method="POST" action="right_id.asp?pid=1" onsubmit="return checkncp1(this)" name="form1" target="menu">
<select name="dl" ID="dl" onChange="changeselect(document.all.dl.options[document.all.dl.selectedIndex].value)">
<option>请选择</option>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from nyxx where pid=0"
rs.open sql,conn,1,1
do while not rs.eof
%>
<option value="<%=rs("id")%>"><%=rs("title")%></option>
<%rs.MoveNext:Loop%>
</select>
<select name="xl" ID="xl" onChange="javascript:select24_onchange()">
<option value="<%rs=("pid")%>">请选择</option>
</select>
<input type="submit" value="确定" name="B1" style="height:20" >
</form>
想在 right_id.asp页面输出 qid相同的内容 并且pid等于1的
right_id.asp 页面内容如下
<!-- #include file="conn.asp" --><%
qid=trim(Request("qid"))
set rs=server.CreateObject("adodb.recordset")
sql = "select * from nyxx where id=id and pid=pid"
rs.Open sql,conn,1,1
%>
<%
dim MaxPerPage
MaxPerPage=20
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
call list
Sub list()%>
<!-- #include file="Inc/Head.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td><table width="100%" height="165" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" valign="top"><table width="100%" height="100%" border="0"cellpadding="0" cellspacing="0" >
<td align="center" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="">
<%
if not rs.eof then
i=0
do while not rs.eof
%>
<tr>
<td width="20%" height="28" style="font-size: 12px;"></td>
<td width="80%" style="line-height:150%;font-size: 14px;"><a href="right_id_c.asp?id=<%=rs("id")%>"><%=rs("title")%></a> </td>
</tr>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
end if
%>
<tr valign="bottom">
<td height="20"></td>
<td height="20">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<div align="center">
<%
Response.write "全部-"
Response.write "共" & Cstr(Rs.RecordCount) & "篇 "
Response.write "第" & Cstr(CurrentPage) & "/" & Cstr(rs.pagecount) & " "
If currentpage > 1 Then
response.write "<a href='right_id.asp?&page="+cstr(1)+"&qid="&qid&"'> 首页 </a>"
Response.write "<a href='right_id.asp?page="+Cstr(currentPage-1)+"&qid="&qid&"'> 上一页 </a>"
Else
Response.write " 上一页 "
End if
If currentpage < Rs.PageCount Then
Response.write "<a href='right_id.asp?page="+Cstr(currentPage+1)+"&qid="&qid&"'> 下一页 </a>"
Else
Response.write ""
Response.write " 下一页 "
End if
Response.write "转到第"
response.write"<select name='sel_page' onChange='javascript:location=this.options[this.selectedIndex].value;'>"
for i = 1 to Rs.PageCount
if i = currentpage then
response.write"<option value='right_id.asp?page="&i&"&qid="&qid&"' selected>"&i&"</option>"
else
response.write"<option value='right_id.asp?page="&i&"&qid="&qid&"'>"&i&"</option>"
end if
next
response.write"</select>页"
%>
</div></td>
<td height="20"> </td>
</tr>
</table>
<%
End sub
rs.close
%></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
请哪位高手帮忙解决一下
万份感谢!!!!!! |
|