js如何在页面关闭之前利用iframe隐藏提交表单 本帖最后由 guanjie20 于 2011-03-11 12:08:00 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><title>test</title><head><script type="text/javascript">window.onbeforeunload=function(){ if(window.confirm('确定离开吗?')) { window.frames['ifrm'].document.getElementById('ifm').submit();} }</script></head><body> <a href="http://www.baidu.com">百度</a> <iframe style="display: none" src="iframe.html" name="ifrm"></iframe></body></html>改成这样试试! js在主页面是正常的,但是我把js放在iframe上为什么就无效果了,真奇怪,我想把这段执行的js也放在iframe里 为什么这样不行:iframe.html:<html><body onbeforeunload="window.frames['ifrm'].document.getElementById('ifm').submit();"> <form id="ifm" name="ifm" method="get" action="http://test/fuc/"> </form></body></html> onbeforeunload="setTimeout(document.getElementById('ifm').submit(),1000);"或 onbeforeunload="setTimeout(window.frames['ifrm'].document.getElementById('ifm').submit(),1000);" 延迟1秒 没任何反应, 多行图片无间滚动 如何动态刷新css文件,但又不刷新htm页面? js如何实现点击textbox触发回车键? javascript继承不理解 谁能解密这段js代码啊!拜托了 请问我想以参数的形式传递元素ID到函数中去行吗? 提示的颜色 UniCode转换成shift-jis(高手请进) sencha touch中xtype创建dataview不显示(急,救命~) 一个超极端的问题 请教javascript与IE7,IE8不兼容问题 telnet模拟http协议
<title>test</title>
<head>
<script type="text/javascript">
window.onbeforeunload=function(){
if(window.confirm('确定离开吗?'))
{ window.frames['ifrm'].document.getElementById('ifm').submit();}
}</script>
</head>
<body>
<a href="http://www.baidu.com">百度</a>
<iframe style="display: none" src="iframe.html" name="ifrm"></iframe>
</body>
</html>改成这样试试!
js在主页面是正常的,但是我把js放在iframe上为什么就无效果了,真奇怪,我想把这段执行的js也放在iframe里
iframe.html:
<html>
<body onbeforeunload="window.frames['ifrm'].document.getElementById('ifm').submit();">
<form id="ifm" name="ifm" method="get" action="http://test/fuc/">
</form>
</body>
</html>