js页面的弹框怎么关闭啊

JavaScript09

js页面的弹框怎么关闭啊,第1张

1、单纯的关闭

window.opener.location.reload()//刷新父窗口中的网页

window.close()//关闭当前窗窗口

2、提交后关闭

function save(){

document.getElementById("pointsform").submit()

alert('保存成功')

window.opener.document.getElementById("cmd").value="query"

window.opener.document.getElementById("form的id").submit()//提交

window.close()//关闭当前窗口

}

百度知道

$a.popup打开的弹窗关闭怎么写

民咕咕12336

超过42用户采纳过TA的回答

关注

成为第2位粉丝

在popup,js的reset函数后面加一个函数如

reset_m:function(){top.location.reload()this.close()},

在弹出页面调用即可。

弹出子页面:关闭函数

function closebox1(){

this.parent.Popup.prototype.reset_m()//会刷新父页面

}

调用:

<a href="javascript:closebox2()"><span class="pre">关闭</span></a>

首先iframe中的页面应该与父页面是同域页面,否则跨域的话js无法控制iframe中的内容。

如果父页面与框架中的页面时同域的,可以通过改变a标签的href属性来实现:

1

<a href="javascript:return false" onclick="window.open('http://zhidao.baidu.com/','_self')" target="_blank">猛戳这里</a>

这样实际是把原来链接的作用取消,然后给a标签绑定js的window.open方法打开页面,target也就不起作用了。