修改了一个DIV弹出窗口

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>DIV</title>

 

<script>
function $(v)
 {
  return(document.getElementById(v));
 }
function $S(v)
 {
   return($(v).style);
 }
function agent(v)
{
  return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0));
 }
function isset(v)
{
 return((typeof(v)=='undefined' || v.length==0)?false:true);
}
function XYwin(v)
{
 var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth);

return(isset(v)?z[v]:z);
}

function sexyTOG()
{
 document.onclick=function(){ $S('sexyBG').display='none'; $S('sexyBOX').display='none'; document.onclick=function(){}; };
}
function sexyBOX(t,v,w,h)
{
$S('sexyBG').height=XYwin(0)+'px';
$S('sexyBG').display='block';
$('sexyBOX').innerHTML="<div class=\"sexyT\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td

width=\"50%\">&nbsp;&nbsp;<img src='orangearrow.gif'/>&nbsp;&nbsp;<b>"+t+"</b><\/td><td align=\"right\"><span align=\"right\"

onMouseMove=\"setTimeout('sexyTOG()',1);\" onMouseOut=\"setTimeout('document.onclick=function(){}',1);\"

style=\"cursor:pointer;\"><b>[close]<\/b>"+"<\/span><\/td><\/tr><\/table><\/div>"+v+"";
$S('sexyBOX').left=Math.round((XYwin(1)-w)/2)+'px';
$S('sexyBOX').width=w+'px';
$S('sexyBOX').height=h+'px';
document.getElementById('sexyBOX').style.top=(parseInt(document.body.offsetHeight)-h)/2;
document.getElementById('sexyBG').style.height=h+'px';
document.getElementById('sexyBG').style.width=w+'px';
document.getElementById('sexyBG').style.top=(parseInt(document.body.offsetHeight)-h)/2+4;
document.getElementById('sexyBG').style.left=(Math.round((XYwin(1)-w)/2)+4)+'px';

$S('sexyBOX').display='block';
}

//window.onload=function(){
//document.body.innerHTML="<div id=\"sexyBG\"></div><div id=\"sexyBOX\"></div>"+document.body.innerHTML;
//}
</script>

<style type="text/css">
<!--
body {margin: 0px;}

#sexyBOX { display: none; position: absolute; background: #ECF0F1; color: #333; text-align: center; border: 1px solid

#6CAEC8; z-index: 100; }
#sexyBG{ display: none; position: absolute; background: #000; opacity: 0.4; -moz-opacity: 0.4; -khtml-opacity: 0.4; filter:

alpha(opacity=40); z-index:99; }
.sexyX { font-size: 12px; color: #ddd; padding: 4px 0; border-top: 0px solid #6CAEC8; background-image:url(topb.jpg);}
.sexyT { font-size: 14px; text-align:left; font-weight:bold; color: #000; padding: 4px 0; border-down: 1px solid #636D61;

background-image:url(topb.jpg);}

-->
</style>
</head>
<body>
<p><a   href="#" onClick="sexyBOX('title','sdfg','400','200'); return false;">sexy box</a></p>
<p>&nbsp;</p>

<p><p><a   href="#" onClick="sexyBOX('title','sdfg','400','200'); return false;">sexy box</a></p>&nbsp;</p>

<div id="sexyBG"></div><div id="sexyBOX"></div>
</body>
</html>
 

posted on 2007-10-27 13:29  西湖浪子  阅读(465)  评论(0)    收藏  举报