文件名称:显示div层js.txt
文件大小:4KB
文件格式:TXT
更新时间:2014-05-29 08:49:29
显示div层js.txt显示div层js.txt
/******************************
周旭
DIV弹出层
******************************/
var cTime;
function OpenDivLayer(tag)
{
var divBackground = document.getElementById('divBackground');
var divShow = document.getElementById('divShow');
var Position = getPosition();
divBackground.style.display='block';
divShow.style.display='block';
//背景层
/* 在火狐这样写不行。
divBackground.style.width = document.documentElement.clientWidth; //层的宽度
divBackground.style.height = document.documentElement.clientHeight; //层的高度
divBackground.style.position = "absolute";
divBackground.style.zIndex = "9998";
divBackground.style.left = "0";
divBackground.style.top = "0";
divBackground.style.right = "0";
divBackground.style.filter = "alpha(opacity=60)"; //设置背景透明
divBackground.style.opacity = "0.80";
divBackground.style.color= "#213140";
divBackground.style.backgroundColor = "#7a7a7a";
divBackground.style.textAlign = "center";
*/
//显示层
divShow.style.zIndex = "9999";
divShow.style.position = "absolute";
divShow.style.top=(Position.top+85) +"px";
divShow.style.left="34%";//(Position.left+510) +"px";
divShow.style.padding = "0px";
divShow.style.backgroundColor="#FFFFFF";
divShow.style.border="1px solid #ff6600";
divShow.style.textAlign = "right";
window.onscroll = function ()
{
var Position = getPosition();
divBackground.style.top = Position.top +"px";
divBackground.style.left = Position.left +"px";
divShow.style.top = (Position.top+85) +"px";
divShow.style.left = "34%";//(Position.left+510) +"px";
};
if(tag == '1')
{
cTime=3;
TimeClose();
}
if(tag == '2')
{
document.getElementById('Send').style.display='block';
document.getElementById('Move').style.display='none';
}
if(tag == '3')
{
document.getElementById('Send').style.display='none';
document.getElementById('Move').style.display='block';
}
//return false;
}
function CloseDivLayer()
{
document.getElementById('divBackground').style.display='none';
document.getElementById('divShow').style.display='none';
//return false;
}
function getPosition()
{
var top = document.documentElement.scrollTop;
var left = document.documentElement.scrollLeft;
var height = document.documentElement.clientHeight;
var width = document.documentElement.clientWidth;
return {top:top,left:left,height:height,width:width};
}
//让背景渐渐变暗
function showBackground(obj,endInt)
{
var al=parseFloat(obj.style.opacity);
al+=0.01;
obj.style.opacity=al;
if(al<(endInt/100))
{setTimeout(function(){showBackground(obj,endInt)},5);}
}
function TimeClose()
{
if(cTime>=0)//判断秒数如果为0
{
document.getElementById("ShowMag").innerHTML="
"+cTime+"";//显示倒计时时间
//document.getElementById("ShowMag").innerHTML="
"+cTime+"";//显示倒计时时间
cTime--;//减少秒数
window.setTimeout('TimeClose()',1000);//让程序每秒重复执行当前函数。
}
else
{
document.getElementById("ShowMag").style.display='none';
document.getElementById("divWinInfo").style.display='block';
}
}