asp的刷新

zycsj 2001-02-28 05:19:00
因为IE中刷新没有时间,请问在asp中或javascript中如何判断用户点取的是刷新按钮
...全文
274 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zycsj 2001-03-01
  • 打赏
  • 举报
回复
是我没说清楚,因为我用了一个框架的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);
}

//-->
</SCRIPT>

<p>学科

   
<select name="subject" size="1" LANGUAGE=javascript onchange="return SelChange(0)" >
<option value=""></option>
<%
'查询学科
'rs.open "SELECT DISTINCT subject FROM 学科分类表", GetConnectionString(), 1, 2
while not rs.eof
tmp=Trim(rs("subject"))
%>
<option value="<%=tmp%>"><%=tmp%></option>
<%
rs.movenext
wend
%> </select>(必选项)
</p>
<p>学科专题
<select name="sub_subject" size="1" onchange="return SelChange(1)">
<option > </option>
</select>
</p>
<p> 知识单元
<select name="kno_unit" onchange="return SelChange(2)">
</select>
</p>
<p> 知识点  
<select name="kno_point" >
</select>
</p>
amay 2001-03-01
  • 打赏
  • 举报
回复
独孤求胜:对于后者,是不是同样也可以用onunload().
我是这样运用它的:<body onload="mappageLoad();" onunload="mappageunload();">
在函数,判断当前窗体的名字,if (typeof(objwindow)!= "undefined"){.....}不管用户有没有按刷新,只要页面动作了就应该捕捉到这个信息,对吗?
farrio 2001-03-01
  • 打赏
  • 举报
回复
你的意思是说知道用户刷新本页,还是捕获用户点击“刷新按钮”?
如果是前者,可以用window.unonload()函数判断;
如果是后者,可能就很难了。需要高人指点。
dhwan 2001-03-01
  • 打赏
  • 举报
回复
什么意思?
zycsj 2001-03-01
  • 打赏
  • 举报
回复
问题有点复杂,如果需要源代码,请留下mail
Itboy 2001-03-01
  • 打赏
  • 举报
回复
查找“刷新”,和你类似的问题已经有答案了。
amay 2001-03-01
  • 打赏
  • 举报
回复
supersonics说得极好,开发这东东,是一种思维,一种概念,重要的是自己去琢磨。虽然我做的不好,我还是希望自己在这方面得到提高。
supersonics 2001-03-01
  • 打赏
  • 举报
回复
你到底想干嘛?
这么长的代码让别人来看,不如让别人替你做好了。
我想提问的人应当得到的是:思想方法或技术细节,而不是结果。
tripofdream 2001-02-28
  • 打赏
  • 举报
回复
什么目的?
happyno9 2001-02-28
  • 打赏
  • 举报
回复
你的问题我看不明白

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧