使用层来模仿confirm的效果,无论窗口大小如何改变用于用于交互的2各层始终位于窗口中央位置。css用来定制滚动条的效果js控制层的显示与隐藏以及背景层的大小 <style type="text/css">...html{...}{height:100%}body{...}{ margin:0; /**//* 必须 */ height:100%; /**//* 必须 */ overflow-y:auto;/**//* 必须 */ }#divConfim{...}{ background-color:#92E076;background-image: url(../Skin/Computer/Online/Install_Background.gif);z-index:10001; position:fixed !important; /**//*For FF*/ left:expression((document.body.clientWidth-this.offsetWidth)/2);position:absolute; /**//*For IE*/ top:expression((document.body.clientHeight-this.offsetHeight-20)/2);}#submitPaper{...}{ background-color:#92E076;background-image: url(../Skin/Computer/Online/Install_Background.gif);z-index:10002; position:fixed !important; /**//*For FF*/ left:expression((document.body.clientWidth-this.offsetWidth)/2);position:absolute; /**//*For IE*/ top:expression((document.body.clientHeight-this.offsetHeight-20)/2);}<div id="bgDiv" style=" background:#000; z-index:10000; position:absolute; left:0px; top:0px;filter:alpha(opacity=20); color: #ffffff; display:none;"> </div> <script> divW(); function divW() {...}{ bgDiv.style.width=(document.body.clientWidth-15); bgDiv.style.height=(document.body.clientHeight); } function window.onresize() {...}{ bgDiv.style.width=(document.body.clientWidth); bgDiv.style.height=(document.body.clientHeight); } </script> <div id="divConfim" align="center" style="width: 400; height: 252;display:none; "> <table width="400" height="252" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <p> <img src="../Skin/Computer/Online/Install_Notice4.gif" width="130" height="16" /></p> <p> </p> <table width="147" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60" height="40" align="center" style=" background-color:#FFC255;cursor:hand;"> <a href="javascript:;" class="bt3font" onclick="yes()" style="color: #CC5200; font-size: 18px; font-family: 黑体">是</a></td> <td width="50"> </td> <td height="40" align="center" style="background-color:#FFC255;cursor:hand; width: 60px;"> <a href="javascript:;" class="bt3font" onclick="no();go()" style="color: #CC5200; font-size: 18px; font-family: 黑体">否</a></td> </tr> </table> </td> </tr> </table> </div> <div id="submitPaper" align="center" style="width: 400; height: 252;display:none; "> <table width="400" height="252" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <p> <img src="../Skin/Computer/Online/Install_Notice3.gif" width="233" height="16" /></p> <p> </p> <table width="94" border="0" cellspacing="0" cellpadding="0"> <!--DWLayoutTable--> <tr> <td height="40" align="center" style="background-color:#FFC255; cursor:hand; width: 94px;"> <a href="javascript:;" onclick="yes()" class="bt3font" style="color: #CC5200; font-size: 18px; font-family: 黑体">确 定</a></td> </tr> </table> </td> </tr> </table> </div>