
键不放,同时用鼠标点击网页的关闭按扭。你会发现这其中的第三种方式相当有效。windowclose();这方法是关闭当前浏览器窗口,关闭整个浏览器,这是不符合实际的,现在的浏览器大多数用户基本上都已经使用了
选项卡
式,关闭其他浏览页面对于用户来说是不明智的~~而且也没有关闭这种选项卡浏览器的方法 function countDown(secs, surl) {
//alert(surl);
var jumpTo = documentgetElementById('jumpTo');
jumpToinnerHTML = secs;
if (--secs > 0) {
setTimeout("countDown(" + secs + ",'" + surl + "')", 1000);
}
else {
//兼容360,IE火狐的关闭窗口方法 > CHROME + Gecko + MS > 需要用户accept,除非通过用户的动作激发
windowopen(surl, "_blank");
if (navigatoruserAgentindexOf("MSIE") > 0) {
if (navigatoruserAgentindexOf("MSIE 60") > 0) {
windowopener = null;
windowclose();
thisparentwindowclose();
} else {
windowopen('', '_top');
windowtopclose();
thisparentwindowclose();
}
} else if (navigatoruserAgentindexOf("Firefox") > 0) {
windowlocation = '';
windowtopclose();
thisparentwindowlocation = surl;
thisparentwindowtopclose();
} else {
windowopener = null;
windowopen('', '_self');
windowclose();
thisparentwindowclose();
}
//windowopen('', "_blank");
//windowclose();
//thisparentwindowclose();
}
}
这个需要用户进行 *** 作才能够不会被拦截--会被当作恶意d窗处理
可以通过给新窗口起名,然后再打来的页面通过
windowcolse()来关闭
js关闭当前页面直接调用windowclose()就可以了
做一个触摸屏查询系统,要打开新页面后关闭父界面 百度之functionopenNewWindow() { windowopen("Indexaspx","","left=30,top=30,toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,location=no,directories=no,copyhistory=no,height=620,width=820"); windowopener=null; windowopen("","_self"); windowclose(); }这样写的话,由于窗口拦截的原因,会使新窗口打不开,而且原来的窗口也被关闭了
于是再查询找到解决去方法在新页面中onload="windowopener。opener=null; windowopenerclose();"
1、在html中的表单form设置属性action='#'防止自动提交
2、利用js获取html中表单form,重新设置表单的action
3、action设置完毕后调用formsubmit()方法提交表单
4、表单提交后利用windowclose()关闭当前窗口
示例:
<form action='#' id="myForm"><input type="text" name="username" value=""/>
<input type="button" value="提交" onclick="subform();"/>
</form>
方法:
var form = documentgetElementById('myForm');//获取表单dom
formaction="testurl";//重新设置提交url
formsubmit();//提交表单
windowclose();//关闭窗口
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)