a.html页面里有一个iframe
在点击a.html中一个按钮 iframe里的链接到b.html
在b.html里有一个按钮在a.html里弹出一个层,
在关闭层的时候想要刷新b.html
这个怎么写呀
各位大侠帮帮我~~
在点击a.html中一个按钮 iframe里的链接到b.html
在b.html里有一个按钮在a.html里弹出一个层,
在关闭层的时候想要刷新b.html
这个怎么写呀
各位大侠帮帮我~~
b.html
<script type="text/javascript">
var doma=parent.document;
var docEle = function()
{
return doma.getElementById(arguments[0]) || false;
} function openNewDiv(_id)
{
var m = "mask";
if (docEle(_id)) doma.body.removeChild(docEle(_id));
if (docEle(m)) doma.body.removeChild(docEle(m)); //mask遮罩层 var newMask = doma.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
_scrollWidth = Math.max(doma.body.scrollWidth,doma.documentElement.scrollWidth);
_scrollHeight = Math.max(doma.body.scrollHeight,doma.documentElement.scrollHeight);
newMask.style.width = _scrollWidth + "px";
newMask.style.height = _scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#33393C";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
doma.body.appendChild(newMask); //新弹出层 var newDiv = doma.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
newDivWidth = 400;
newDivHeight = 200;
newDiv.style.width = newDivWidth + "px";
newDiv.style.height = newDivHeight + "px";
newDiv.style.top = (doma.body.scrollTop + doma.body.clientHeight/2 - newDivHeight/2) + "px";
newDiv.style.left = (doma.body.scrollLeft + doma.body.clientWidth/2 - newDivWidth/2) + "px";
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
newDiv.innerHTML = " ";
doma.body.appendChild(newDiv); //弹出层滚动居中 function newDivCenter()
{
newDiv.style.top = (doma.body.scrollTop + doma.body.clientHeight/2 - newDivHeight/2) + "px";
newDiv.style.left = (doma.body.scrollLeft + doma.body.clientWidth/2 - newDivWidth/2) + "px";
}
if(doma.all)
{
window.attachEvent("onscroll",newDivCenter);
}
else
{
window.addEventListener('scroll',newDivCenter,false);
} //关闭新图层和mask遮罩层
var newA = doma.createElement("div");
newA.innerHTML ="关闭";
newA.onclick = function(){
if(doma.all)
{
window.detachEvent("onscroll",newDivCenter); }
else
{
window.removeEventListener('scroll',newDivCenter,false);
}
doma.body.removeChild(docEle(_id));
doma.body.removeChild(docEle(m));
location.reload() //关闭时刷新
return false;
}
newDiv.appendChild(newA);
}
</script>
<body>
<a onclick="openNewDiv('newDiv');return false;" style="cursor:pointer">弹出层</a></body>