是我没说清楚,因为我用了一个框架的html,里面包含两个asp文件,其中一个asp用于给另一个
提供从数据库里查出的数据。因为有时两个asp不同步的原因,在刷新的时候有时会出现错误
第一个asp,因此需要捕获用户刷新是的动作
<%@ Language=VBScript %>
<!-- #include file ="../const.asp" -->
<%
'检查登录
if CheckLogin then
CheckIfLogin
end if
dim subj
dim sub_sub
dim kno_unit
dim changer
subj=request("sub")
sub_sub=request("sub_sub")
kno_unit=request("kno_unit")
changer=Trim(request("changer"))
if changer = "" then
changer=0
else
changer=CInt(changer)
end if
set rs = server.CreateObject("adodb.Recordset") '记录集
filename="material_hide.asp"
%>
<html>
<head>
<title>备课子系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body LANGUAGE=javascript>
subj=<%=subj%>**<br>
sub_sub=<%=sub_sub%>**<br>
kno_unit=<%=kno_unit%>**<br>
changer=<%=changer%>**<br><br><br>
<script language="javascript"><!--
//remove 知识点 select
//while parent.mainleft = null and parent.mainleft.document = null and parent.mainleft.document.frmMain = null and parent.mainleft.document.frmMain.kno_point =null
// location.replace(url);
//next
var coll=parent.mainleft.document.frmMain.kno_point;
while(coll.options.length>0)
{
for(j=0; j< coll.options.length; j++){
coll.remove(0);
}
}
var oOption ;
<% if changer =2 then %>
document.write("查询知识点<br>");
<%
'查询知识点
sql="SELECT DISTINCT knowledge_point FROM 基础教育信息表 WHERE subject ='" & subj & "' AND sub_subject='"
sql=sql&sub_sub&"' and knowledge_unit='"&kno_unit&"'"
rs.open sql, GetConnectionString(), 1, 2
while not rs.eof
tmp=HandleQuotes(Trim(rs("knowledge_point")))
%>
oOption = parent.mainleft.document.createElement("OPTION");
oOption.text="<%= tmp %>";
oOption.value="<%= tmp %>";
coll.add(oOption);
<%
rs.movenext
wend
%>
<% elseif changer < 2 then %>
oOption = parent.mainleft.document.createElement("OPTION");
oOption.text="";
oOption.value="";
coll.add(oOption);
<% end if %>
////////////////////////////////////////////////
//remove 知识单元 select
<% if changer < 2 then %>
//2: 知识单元 select
coll=parent.mainleft.document.frmMain.kno_unit;
while(coll.options.length>0)
{
for(j=0; j< coll.options.length; j++){
coll.remove(0);
}
}
<% end if %>
<% if changer = 1 then %>
document.write("查询知识单元<br>");
coll=parent.mainleft.document.frmMain.kno_unit;
<%
'知识单元
sql="SELECT DISTINCT knowledge_unit FROM 基础教育信息表 WHERE subject ='" & subj & "' AND sub_subject='"
sql=sql&sub_sub&"'"
'rs.close
rs.open sql, GetConnectionString(), 1, 2
while not rs.eof
tmp=HandleQuotes(Trim(rs("knowledge_unit")))
%>
oOption = parent.mainleft.document.createElement("OPTION");
oOption.text="<%= tmp %>";
oOption.value="<%= tmp %>";
coll.add(oOption);
<%
rs.movenext
wend
%>
<% elseif changer < 1 then %>
coll=parent.mainleft.document.frmMain.kno_unit;
oOption = parent.mainleft.document.createElement("OPTION");
oOption.text="";
oOption.value="";
coll.add(oOption);
<% end if %>
////////////////////////////////////////
<% if changer = 0 then %>
//1: 学科专题 select
coll=parent.mainleft.document.frmMain.sub_subject;
while(coll.options.length>0)
{
for(j=0; j< coll.options.length; j++){
coll.remove(0);
}
}
document.write("查询学科专题<br>");
<%
'学科专题
dim count
count=0
sql="SELECT DISTINCT sub_subject FROM 基础教育信息表 WHERE subject ='" & subj & "'"
'rs.close
rs.open sql, GetConnectionString(), 1, 2
while not rs.eof
tmp=HandleQuotes(Trim(rs("sub_subject")))
%>
oOption = parent.mainleft.document.createElement("OPTION");
oOption.text="<%= tmp %>";
oOption.value="<%= tmp %>";
coll.add(oOption);
<%
rs.movenext
count=count+1
wend
%>
<% if count=0 then %>
oOption = parent.mainleft.document.createElement("OPTION");
oOption.text="";
oOption.value="";
coll.add(oOption);
<%end if%>
<% end if %>
//-->
</script>
</body>
</html>
第二个asp一部分
<%filename="uploadmaterial_hide.asp" %>
<SCRIPT language="javascript">
<!--
function SelChange(changer)
{
var sub
var sub_sub
var kno_unit
sub=document.frmMain.subject.value;
sub_sub=document.frmMain.sub_subject.value;
kno_unit=document.frmMain.kno_unit.value;
var url="<%=filename%>?sub="+sub
switch(changer)
{
case 0:
url=url;
break;
case 1:
url=url+"&sub_sub="+sub_sub;
break;
case 2:
url=url+"&sub_sub="+sub_sub+"&kno_unit="+kno_unit;
break;
default:
url=url;
}
url=url+"&changer="+changer;
//alert(changer+"***"+url);
parent.mainright.location.replace(url);
}