最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js 浮动窗口代码
时间:2010-01-15 编辑:简简单单 来源:一聚教程网
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 showPop(width,height){
var width=width? width:150;
var height=height? height:100;
var pop = document.getElementById("pop");
pop.style.display = "block";
pop.style.position = "absolute";
pop.style.zindex = "999";
pop.style.width = width + "px";
pop.style.height = height + "px";
var Position = getPosition();
leftadd = (Position.width-width)/2;
topadd = (Position.height-height)/2;
pop.style.top = (Position.top + topadd) + "px";
pop.style.left = (Position.left + leftadd) + "px";
window.onscroll = function (){
var Position = getPosition();
pop.style.top = (Position.top + topadd) +"px";
pop.style.left = (Position.left + leftadd) +"px";
}
}
function hidePop(){
document.getElementById("pop").style.display = "none";
}
function setPopTitle(title){
document.getElementById("poptitle").innerHTML= title;
}
function setPopMsg(popmsg){
document.getElementById("popmsg").innerHTML= popmsg;
}
var dance=0;
function divDance(divname) {
var div=document.getElementById(divname);
if(div.style.color=='red'){
div.style.color='black'
}else{
div.style.color='red'
}
dance++;
timer=setTimeout("divDance('"+divname+"')",0.2*1000);
if(dance>10){
clearTimeout(timer);
dance=0;
div.style.color='red'
}
}
function bytes(str){
var len=0;
for(var i=0;i
len++;
}
len++;
}
return len;
}
-
上一个: js 日历选择器代码
-
下一个: js color 选择器
相关文章
- js中不使用blank在新窗口打开链接的方法 04-18
- js top.location判断自身是否是顶级窗口 01-08
- 父窗口与子窗口相互调用js代码 08-18
- js+div可控制显隐且随意拖动的窗口 01-26
- js防士豆可控制打开新窗口代码 10-30
- js打开新窗口代码 08-20