要用到两个文件d.html和e.html d.html <html> <head> <mce:style type="text/css"><!-- .proccess{border:0px solid;border-color:#009900;width:2;height:15;background:eeeeee;margin:0} --></mce:style><style type="text/css" mce_bogus="1">.proccess{border:0px solid;border-color:#009900;width:2;height:15;background:eeeeee;margin:0}</style> <mce:style><!-- body{}{ margin:0px; } --></mce:style><style mce_bogus="1">body{}{ margin:0px; } </style> <title></title> <mce:script type="text/javascript"><!-- function DivAlert(messageDiv){ this.messageDIV=messageDiv; //创建提示框底层 this.bottomDIV = document.createElement("div"); //获取body中间点 var x=document.body.clientWidth/2,y=document.body.clientHeight/2; //配置样式 this.bottomDIV.style.opacity="0.50"; this.bottomDIV.style.filter="Alpha(opacity=50);"; this.bottomDIV.style.backgroundColor="#7DAFE1"; this.bottomDIV.style.height=document.body.scrollHeight+"px"; this.bottomDIV.style.width="100%"; this.bottomDIV.style.marginTop="0px"; this.bottomDIV.style.marginLeft="0px"; this.bottomDIV.style.position="absolute"; this.bottomDIV.style.top="0px"; this.bottomDIV.style.left="0px"; this.bottomDIV.style.zIndex=100; //显示提示框 this.show = function(){ //显示提示框底层 document.body.appendChild(this.bottomDIV); //显示messageDIV document.body.appendChild(this.messageDIV); //把messageDIV定位到body中间 this.messageDIV.style.position="absolute"; x=x-this.messageDIV.clientWidth/2; y=y-this.messageDIV.clientHeight/2; this.messageDIV.style.top=y+"px"; this.messageDIV.style.left=x+"px"; this.messageDIV.style.zIndex=101; } //移除提示框 this.remove = function(){ document.body.removeChild(this.bottomDIV); document.body.removeChild(this.messageDIV); } } //测试DivAlert对象 var dc; function test(){ //创建提示框内容部分 var d = document.createElement("div"); d.style.width="300px"; d.style.height="400px"; d.style.backgroundColor="#7DAFE1"; d.style.padding="10px"; //向提示框内容部分画需要显示的信息 d.innerHTML="<a href="/go.html?url=e.html" mce_href="/go.html?url=e.html">执行跳转</a>"; //实例化提示框 dc = new DivAlert(d); //显示提示框 dc.show(); } //提示框里的Button按钮点击事件 function test2(){ //移除对话框 dc.remove(); } // --></mce:script> </head> <body > <a href="/go.html?url=javascript:void(0)" mce_href="/go.html?url=javascript:void(0)" onClick="test();">单击我,隐藏父窗口!</a> </body> </html> <html> <head> 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交