一个关闭Div的JS问题,急用,大家帮帮忙!!!!!! 我在一个JS文件里写了个JS。。在页面输出一个层。。代码如下:document.write('<div id="massage_box" style="position:absolute; FILTER: progid:DXImageTransform.Microsoft.DropShadow();z-index:10001;display:none">');document.write('</div>');我要在页面关闭这个层的时候要怎么关闭。写了半天没写出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你已经display:none还要干什么? document.getElementById("massage_box").style.display = "none";或var div = document.getElementById("massage_box");div.parentNode.removeChild(div);如果你要在页面中反复多次输出这个div就用第二种,否则第一种就可。 document.getElementById("massage_box").style.display = "none" 完整的JS是这样的..//ajax提示框========================================function openWithIframe(tit,url,w,h){ var sWidth,sHeight; sWidth=document.body.clientWidth; sHeight=document.body.scrollHeight; if(sHeight<window.screen.height){sHeight=window.screen.height;} var bgObj=document.createElement("div");//创建一个div对象(背景层) //定义div属性,即相当于 // <div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:19999;"></div> bgObj.setAttribute('id','bgDiv'); bgObj.style.position="absolute"; bgObj.style.top="0"; bgObj.style.background="#000000"; bgObj.style.filter="Alpha(Opacity=30);"; bgObj.style.left="0"; bgObj.style.width=sWidth + "px"; bgObj.style.height=sHeight + "px"; bgObj.style.zIndex = "10000"; document.body.appendChild(bgObj);// var news=$("<iframe id='bgDiv' style='position:absolute;background:#000000;' frameborder='0' scrolling='no'>34</iframe>");// $('body').append(news); massage_box.style.left = (document.body.clientWidth - w) / 2; massage_box.style.top = (screen.height - h) / 2-80; massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape massage_box.style.screeny = (screen.height - h) / 2-80;//仅适用于Netscape massage_box.style.width = w+"px"; massage_box.style.height = h+"px"; pop_title.innerHTML=tit; massage_box.style.display='' var popiframe='<iframe src="'+url+'" width="'+(w-11)+'px" height="'+(h-36)+'px" frameborder=0 scrolling=auto></iframe>'; pop_iframe.innerHTML=popiframe; //alert(bgObj);}function closeWithIframe(){ massage_box.style.display="none"; document.body.removeChild(document.getElementById("bgDiv")); //document.write('aaa');}document.write('<div id="massage_box" style="position:absolute; FILTER: progid:DXImageTransform.Microsoft.DropShadow();z-index:10001;display:none">');document.write('<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; line-height:150%">');document.write('<div onmousedown=MDown(massage_box) style="background-image:url(../../images/list_08.jpg); height:22px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;font-weight:400;color:#006600;cursor:move;padding:0 0 4px 0">');document.write('<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title></div>');document.write('<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px"><img src="../../images/list_09.jpg" width="19" height="19" /></span>');document.write('</div>');document.write('<div style="padding:5px" id=pop_iframe></div>');document.write('</div>');document.write('</div>');//ajax提示框功能========================================是一个弹出层..用上面的方法行不通..不知道为什么.. function openWithIframe(tit,url,w,h) { var sWidth,sHeight; sWidth=document.body.clientWidth; sHeight=document.body.scrollHeight; if(sHeight <window.screen.height){sHeight=window.screen.height;} var bgObj=document.createElement("div");//创建一个div对象(背景层) //定义div属性,即相当于 // <div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:19999;"> </div> bgObj.setAttribute('id','bgDiv'); bgObj.style.position="absolute"; bgObj.style.top="0"; bgObj.style.background="#000000"; bgObj.style.filter="Alpha(Opacity=30);"; bgObj.style.left="0"; bgObj.style.width=sWidth + "px"; bgObj.style.height=sHeight + "px"; bgObj.style.zIndex = "10000"; document.body.appendChild(bgObj); // var news=$(" <iframe id='bgDiv' style='position:absolute;background:#000000;' frameborder='0' scrolling='no'>34 </iframe>"); // $('body').append(news); massage_box.style.left = (document.body.clientWidth - w) / 2; massage_box.style.top = (screen.height - h) / 2-80; massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape massage_box.style.screeny = (screen.height - h) / 2-80;//仅适用于Netscape massage_box.style.width = w+"px"; massage_box.style.height = h+"px"; pop_title.innerHTML=tit; massage_box.style.display='' var popiframe=' <iframe src="'+url+'" width="'+(w-11)+'px" height="'+(h-36)+'px" frameborder=0 scrolling=auto> </iframe>'; pop_iframe.innerHTML=popiframe; //alert(bgObj); } function closeWithIframe(){ document.getElementById("massage_box").style.display="none"; document.body.removeChild(document.getElementById("bgDiv")); //document.write('aaa'); } document.write(' <div id="massage_box" style="position:absolute; FILTER: progid:DXImageTransform.Microsoft.DropShadow();z-index:10001;display:none">'); document.write(' <div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; line-height:150%">'); document.write(' <div onmousedown2=MDown(massage_box) style="background-image:url(../../images/list_08.jpg); height:22px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;font-weight:400;color:#006600;cursor:move;padding:0 0 4px 0">'); document.write(' <div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title> </div>'); document.write(' <span onclick="javascript:closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px"> <img src="../../images/list_09.jpg" width="19" height="19" /> </span>'); document.write(' </div>'); document.write(' <div style="padding:5px" id=pop_iframe> </div>'); document.write(' </div>'); document.write(' </div>'); openWithIframe("AAA","default.aspx",300,200); openWithIframe("AAA","default.aspx",300,200);我想的是在 default.aspx 这个页面去关闭 上面的层 不是触发 openWithIframe() 这个方法的页面 window.parent.openWithIframe(); 这个要怎么用.... defaut. aspx中你需要的地方。 错了,是window.parent.closeWithIframe() 对了..我想问你(cpp2017) 有没有做的Word 的报表的打印和预览 word?什么意思?asp.net做word? 像这个网址上面这个功能..我截图下来的.http://www.fjjdw.com/temp/index.aspx 我不知道他那个功能是怎么做的..是word 转为 PDF 来显示的还是 直接显示Word 我觉得他是直接显示word的.... 求一正则 有没有生成网页缩略图的控件 请问在ASP.NET中要算绝对值的话用什么函数?要导什么包呢? VSS 2005 怎么用呀。。。。。。。。。。。。。。 CSDN大BUG,可以看到SQL密码 新2005关于邮件的问题(简体中文版V.1.0) 在A服务器上访问B服务器上的数据库,可以实现吗? 求一个附件上传的代码 高手请进:微软输入法 与 js控制textbox的value冲突 vs.net 中framework SDK提到的源码示例,那里有down? 想实现 控制访问权限 见鬼了,SQL Between
var div = document.getElementById("massage_box");
div.parentNode.removeChild(div);
如果你要在页面中反复多次输出这个div就用第二种,否则第一种就可。
//ajax提示框========================================
function openWithIframe(tit,url,w,h){
var sWidth,sHeight;
sWidth=document.body.clientWidth;
sHeight=document.body.scrollHeight;
if(sHeight<window.screen.height){sHeight=window.screen.height;}
var bgObj=document.createElement("div");//创建一个div对象(背景层)
//定义div属性,即相当于
// <div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:19999;"></div>
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#000000";
bgObj.style.filter="Alpha(Opacity=30);";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
// var news=$("<iframe id='bgDiv' style='position:absolute;background:#000000;' frameborder='0' scrolling='no'>34</iframe>");
// $('body').append(news);
massage_box.style.left = (document.body.clientWidth - w) / 2;
massage_box.style.top = (screen.height - h) / 2-80;
massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape
massage_box.style.screeny = (screen.height - h) / 2-80;//仅适用于Netscape
massage_box.style.width = w+"px";
massage_box.style.height = h+"px";
pop_title.innerHTML=tit;
massage_box.style.display=''
var popiframe='<iframe src="'+url+'" width="'+(w-11)+'px" height="'+(h-36)+'px" frameborder=0 scrolling=auto></iframe>';
pop_iframe.innerHTML=popiframe;
//alert(bgObj);
}
function closeWithIframe(){
massage_box.style.display="none";
document.body.removeChild(document.getElementById("bgDiv"));
//document.write('aaa');
}
document.write('<div id="massage_box" style="position:absolute; FILTER: progid:DXImageTransform.Microsoft.DropShadow();z-index:10001;display:none">');
document.write('<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; line-height:150%">');
document.write('<div onmousedown=MDown(massage_box) style="background-image:url(../../images/list_08.jpg); height:22px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;font-weight:400;color:#006600;cursor:move;padding:0 0 4px 0">');
document.write('<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title></div>');
document.write('<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px"><img src="../../images/list_09.jpg" width="19" height="19" /></span>');
document.write('</div>');
document.write('<div style="padding:5px" id=pop_iframe></div>');
document.write('</div>');
document.write('</div>');
//ajax提示框功能========================================是一个弹出层..用上面的方法行不通..不知道为什么..
{
var sWidth,sHeight;
sWidth=document.body.clientWidth;
sHeight=document.body.scrollHeight;
if(sHeight <window.screen.height){sHeight=window.screen.height;}
var bgObj=document.createElement("div");//创建一个div对象(背景层)
//定义div属性,即相当于
// <div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:19999;"> </div>
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#000000";
bgObj.style.filter="Alpha(Opacity=30);";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
// var news=$(" <iframe id='bgDiv' style='position:absolute;background:#000000;' frameborder='0' scrolling='no'>34 </iframe>");
// $('body').append(news);
massage_box.style.left = (document.body.clientWidth - w) / 2;
massage_box.style.top = (screen.height - h) / 2-80;
massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape
massage_box.style.screeny = (screen.height - h) / 2-80;//仅适用于Netscape
massage_box.style.width = w+"px";
massage_box.style.height = h+"px";
pop_title.innerHTML=tit;
massage_box.style.display=''
var popiframe=' <iframe src="'+url+'" width="'+(w-11)+'px" height="'+(h-36)+'px" frameborder=0 scrolling=auto> </iframe>';
pop_iframe.innerHTML=popiframe;
//alert(bgObj);
}
function closeWithIframe()
{
document.getElementById("massage_box").style.display="none";
document.body.removeChild(document.getElementById("bgDiv"));
//document.write('aaa');
}
document.write(' <div id="massage_box" style="position:absolute; FILTER: progid:DXImageTransform.Microsoft.DropShadow();z-index:10001;display:none">');
document.write(' <div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; line-height:150%">');
document.write(' <div onmousedown2=MDown(massage_box) style="background-image:url(../../images/list_08.jpg); height:22px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;font-weight:400;color:#006600;cursor:move;padding:0 0 4px 0">');
document.write(' <div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title> </div>');
document.write(' <span onclick="javascript:closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px"> <img src="../../images/list_09.jpg" width="19" height="19" /> </span>');
document.write(' </div>');
document.write(' <div style="padding:5px" id=pop_iframe> </div>');
document.write(' </div>');
document.write(' </div>'); openWithIframe("AAA","default.aspx",300,200);
我想的是在 default.aspx 这个页面去关闭 上面的层 不是触发 openWithIframe() 这个方法的页面
方。
window.parent.closeWithIframe()
http://www.fjjdw.com/temp/index.aspx
我觉得他是直接显示word的....