<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>网页中div 弹出小窗口-webjx.com</title> <style type="text/css">
*{margin:0px;padding:0px;} html,body{font-size:12px;background:#fff;text-align:center;font-family:"宋体";color:#000} html{min-width:950px} body >div{margin:0 auto;text-align:center} div,p,span,form,ul,ol,li,img{margin:0;padding:0;border:0} ul,ol,li,dd{list-style:none} table,td,input{font-size:12px} h1,h2,h3,h4,h5,h6{margin:0;padding:0;font-size:12px;font-weight:normal} a:link{font-size:12px;text-decoration:none;font-family:"宋体"} a:visited{font-size:12px;text-decoration:none} a:hover{text-decoration:underline} a:active{font-size:12px;text-decoration:none}.clear{clear:both;font-size:0px;visibility:0px} #tp{width:950px;margin:0 auto} #tanceng{width:144px;float:left;height:168px;border-bottom:2px solid #163BBB; background:#eee;} #tanceng ul{width:130px;margin:4px 0px 0px 12px;border:0px solid #f00;} #tanceng li{float:left;padding-right:6px;line-height:23px;color:#000; width:100%;} #tanceng li a{color:#000;text-decoration:none} #tanceng li a:hover{color:#000;text-decoration:underline} #tanceng .more{padding-right:0px} #tanceng .lan{color:#2343B1} #tanceng .lan a{color:#2343B1;text-decoration:underline} #tanceng .lan a:hover{color:#2343B1;text-decoration:none} /*080222首页弹层*/ .ttou{border-width:1px 4px 0 1px; border-style:solid; border-color:#fbc364; background-color:#feeed5; height:21px; width:287px; text-align:left; padding:8px 9px 0 21px; font-size:14px; font-weight:bold; color:#ff6906;} .ttou span{color:#000; float:right; font-size:12px; font-weight:normal; padding-top:1px;} .ttou a, .ttou a:hover{color:#4240a1;} .tzhong{width:292px; height:177px; border-width:0 4px 4px 1px; border-style:solid; border-color:#fbc364; background-color:#fff; padding:15px 0 9px 25px;}.tzhong li{float:left; text-align:center; width:55px; line-height:28px;} .tzhong li a{color:#000;}/*.tdi{border-width:0 4px 4px 1px; border-style:solid; border-color:#fbc364; background-color:#fff; width:287px; height:15px; overflow:hidden; text-align:right; padding:0 30px 10px 0;}*/ .menu_iframe{position:absolute; visibility:inherit; top:0px; left:0px; width:322px; z-index:-1; filter: Alpha(Opacity=0); height:235px;} </style> <meta content="text/html; charset=gb2312" http-equiv="Content-Type" />
</head> <body> 弹出层 弹出一个div层 ajax 弹出层 弹出层特效 鼠标经过弹出层 css 弹出效果 <script type="text/javascript"> function getObject(objectId) { if(document.getElementById && document.getElementById(objectId)) { // W3C DOM return document.getElementById(objectId); } else if (document.all && document.all(objectId)) { // MSIE 4 DOM return document.all(objectId); } else if (document.layers && document.layers[objectId]) { // NN 4 DOM.. note: this won't find nested layers return document.layers[objectId]; } else { return false; } } </script> <div id="tp"> <div id="tanceng"> <ul> <li><a href="#">弹出1</a></li> <li><a href="#">弹出2</a></li> <li><a href="#">弹出3</a></li> <li class="lan more" style="position: relative"><a οnclick="sAlert()" href="javascript:void(0)">更多>></a></li> </ul> </div> <script type="text/javascript"> function sAlert(){ var eSrc=(document.all)?window.event.srcElement:arguments[1]; var shield = document.createElement("DIV1"); shield.id = "shield"; shield.style.position = "absolute"; shield.style.left = "0px"; shield.style.top = "0px"; shield.style.width = "100%"; shield.style.height = ((document.documentElement.clientHeight>document.documentElement.scrollHeight)?document.documentElement.clientHeight:document.documentElement.scrollHeight)+"px"; shield.style.background = "#333"; shield.style.textAlign = "center"; shield.style.zIndex = "10000"; shield.style.filter = "alpha(opacity=0)"; shield.style.opacity = 0; var alertFram = document.createElement("DIV1"); alertFram.id="alertFram"; alertFram.style.position = "absolute"; alertFram.style.left = "515px"; alertFram.style.top = "315px"; alertFram.style.marginLeft = "-10px" ; alertFram.style.marginTop = "-200px"; alertFram.style.width = "322px"; alertFram.style.height = "230px"; alertFram.style.zIndex = "10001"; strHtml = "<h2 class=/"ttou/"><span class=/"close/">[<a href=/"javascript:void(null);/" οnclick=/"doOk();/">关闭</a>]</span>tttttt</h2>/n"; strHtml += "<iframe class=/"menu_iframe/"></iframe>/n"; strHtml += "<div id=/"postform/" class=/"tzhong/">/n"; strHtml += " <ul>/n"; strHtml += " <li><a href=/"#/">111111</a></li>/n"; strHtml += " <li><a href=/"#/">222222</a></li>/n"; strHtml += "</ul></div>/n"; alertFram.innerHTML = strHtml; document.body.appendChild(alertFram); document.body.appendChild(shield); this.setOpacity = function(obj,opacity){ if(opacity>=1)opacity=opacity/100; try{ obj.style.opacity=opacity; }catch(e){} try{ if(obj.filters.length>0&&obj.filters("alpha")){ obj.filters("alpha").opacity=opacity*100; }else{ obj.style.filter="alpha(opacity=/""+(opacity*100)+"/")"; } }catch(e){} } var c = 0; this.doAlpha = function(){ if (++c > 20){clearInterval(ad);return 0;} setOpacity(shield,c); } var ad = setInterval("doAlpha()",1); this.doOk = function(){ //alertFram.style.display = "none"; //shield.style.display = "none"; document.body.removeChild(alertFram); document.body.removeChild(shield); eSrc.focus(); document.body.onselectstart = function(){return true;} document.body.oncontextmenu = function(){return true;} } eSrc.blur(); document.body.onselectstart = function(){return false;} document.body.oncontextmenu = function(){return false;} } </script> <!--0222日修改结束 --> <div class="clear"> </div> </div> </body> </html>