window.opener.location.reload()的使用
来源:互联网 发布:腾讯视频区淘宝广告 编辑:程序博客网 时间:2024/05/16 13:07
- 问题内容:window.opener.location.reload()的使用,大家帮忙啊
- 原讨论链接:http://community.csdn.net/expert/topicview1.asp?id=1685384
- 所属论坛:JavaScript 审核组:WEB开发
- 提问者:sdsugar 解决者:fason
- 感谢:Estyle、xinyunyishui、fason
- 关键字:
- 答案:
我的score.php是用来显示数据的,其中有这么一个按钮:
<input type=button name=edit value=添加 onclick=javascript:window.open('scoreadd.php?,'_blank','width=600,height=350,top=150,left=250','toolbar=no,menubar=no,scrollbars=yes')>
scoreadd.php是用来添加按钮的。
里面有这么一个FROM:
<form name=scoreadd action="scoreadd.php?bjscore_tbname=<?echo $bjscore_tablename;?>&bjstu_tablename=<?echo $bjstu_tablename;?>" method=post onsubmit="return userconfirm(this)" onclick="window.opener.location.reload()">
成绩:<input name=score onfocus=this.select() onMouseOver=this.focus()></input>
排名:<input name=paiming onfocus=this.select() onMouseOver=this.focus()></input>
<input type=submit value=确定 >
<input type=reset value=重写>
</form>
<script>
function userconfirm(f)
{
var s="学号:"+f.stuname.value+"/n成绩:"+f.score.value+"/n排名:"+f.paiming.value+"/n确认要添加吗?"
if(confirm(s)) return true
return false
}
onclick="window.opener.location.reload()"一句当然是为了让父窗口刷新的。
onsubmit="return userconfirm(this)"是为了在提交之前弹出一个确定的消息框。
现在问题是,如果按照上面的代码把onclick="window.opener.location.reload()"放在FORM里,那么不等你确定那个消息框,父窗口就已经在添加数据之前刷新了。该怎么办呢。我后来把window.opener.location.reload()放到function里面,即:
<script>
function userconfirm(f)
{
var s="学号:"+f.stuname.value+"/n成绩:"+f.score.value+"/n排名:"+f.paiming.value+"/n确认要添加吗?"
if(confirm(s))
{window.opener.location.reload()
return true
} //或者两句的顺序换一下
return false
}
</script>
可是这样还是不行。高手请指教啊!!!谢谢了
---------------------------------------------------------------
{
window.opener.location.reload();
return true;
}
最明显的错误就是你没有加分号!你先改改,看还有没有错误!
---------------------------------------------------------------
你要通过页面处理表单的吧?
php:
<?……//这里是你的表单处理程序
echo "<script>opener.location.reload()</script>";
?>
asp:
<%……'这里是你的表单处理程序
response.write "<script>opener.location.reload()</script>"
%>
---------------------------------------------------------------
去掉onclick="window.opener.location.reload()"
在新打开的一页中
<body onload="window.opener.location.reload()">
- window.opener.location.reload()的使用
- JavaScript window.opener.location.reload
- window.opener.location.reload() and href的区别
- (转)window.opener.location.reload() and href的区别
- window.opener.location.reload() and href的区别
- window.opener.location.reload() and href()的区别
- 关于opener.location.reload()
- window.opener.location.reload() and href()的区别 弹出页修改后刷新父窗体
- window.opener.location.reload() and href()的区别 弹出页修改后刷新父窗体 .
- window.opener.location.reload() and href()的区别 弹出页修改后刷新父窗体
- (window,parent,opener,top).location.reload方法汇总
- (window,parent,opener,top).location.reload方法汇总
- android 浏览器怎么支持 window.close() 和window.opener.location.reload(); 方法
- parent.window.opener.location
- window.opener.location.reload() 弹出窗口关闭时用来刷新父窗 口
- window.location.reload;刷新
- window.location.reload;刷新
- window.dialogArguments.location.reload();
- 今天发现了有CSDN测试频道
- 请JS中 innerHTML是干什么
- net 中nt认证
- 实用性设计
- C#(Asp.net)对XML文件增、删、改、查(基于DOM)
- window.opener.location.reload()的使用
- js 关于this的一些语法问题
- 《人生若只如初见——古典诗词的美丽与哀愁》--安意如
- 有关hibernate在ecplise下生成maping,出现错误 an internal error occurred during :"Generating Artifacts"
- Perl Medic: Transforming Legacy Code by Peter J. Scott
- 理解Symbian的命名规则
- 时间格式的设定
- asp.net2.0程序的发布
- Pro Perl Parsing (Pro) by Christopher M. Frenz