随笔- 68  评论- 89  文章- 0 

现在流行的div弹出效果

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 
<title>弹出特效</title>
 
<script>
var falpha
falpha=0
function fchange(){
if (falpha!=90){
        table1.style.filter="alpha(opacity="+falpha+")";
        falpha=falpha+10;
        setTimeout("fchange()",200)
        }
else { falpha=0;
    }
}
function sss(){        
        table1.style.height=(window.document.body.clientHeight>window.document.body.scrollHeight)?window.document.body.clientHeight:window.document.body.scrollHeight;
        table1.style.width="100%";
        table1.style.display='block'
        table2.style.left=window.document.body.scrollWidth/2-100;
        table2.style.top=window.document.body.offsetHeight/2-100
        table2.style.display='block'
        fchange()
}

function freset(){
table1.style.display='none'
table2.style.display='none'
}

</script>


 

<script language="javascript" type="text/javascript">
<!--
var ie=document.all
var ns6=document.getElementById&&!document.all

var dragapproved=false
var z,x,y

function move(e){
if (dragapproved){
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}

function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.className!="table2"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.className=="table2"){
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")

//-->
</script>
</head>

<body>

<div id="table1" style=" background:#FFFFFF; display: none; position: absolute;z-index:1;filter:alpha(opacity=40)" oncontextmenu="return false">
 
</div>

<div class="table2" id="table2" style="position:absolute; onmousedown=MDown(table2);background:#CCCCCC; display:none; z-index:2; width:300; height:200; border-left:solid #000000 1px; border-top:solid #000000 1px; border-bottom:solid #000000 1px; border-right:solid #000000 1px; cursor:move;" cellspacing="0" cellpadding="0" oncontextmenu="return false">
 <input type="button" onClick="freset()" value='确定'> <input type="button" onClick="freset()" value='取消'>
 
</div>


<center>
<input name="button" type="button" onClick="sss()" value='申请提交'>
</center>
 
 

</body>
</html>

posted on 2007-06-21 16:16 噢耶游戏 阅读(...) 评论(...) 编辑 收藏