锁屏JavaScript片段
var docEle = function() {
return document.getElementById(arguments[0]) || false;
}
function cloDiv(){
var overlayID="overlay";
var msgID = "overlayMsg";
document.body.removeChild(docEle(overlayID));
document.body.removeChild(docEle(msgID));
}
function openNewDiv() {
var overlayID="overlay";
var msgID = "overlayMsg";
if (docEle(overlayID)) document.removeChild(docEle(overlayID));
if (docEle(msgID)) document.removeChild(docEle(msgID));
// 消息显示
var newDiv = document.createElement("div");
newDiv.id = msgID;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "999";
newDiv.style.width = "200px";
newDiv.style.height = "30px";
var scrolltop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
var _clientheight=0;
//ie FF 在有DOCTYPE时各有区别
_clientheight = Math.min(document.body.clientHeight , document.documentElement.clientHeight);
if(_clientheight==0)
_clientheight= Math.max(document.body.clientHeight , document.documentElement.clientHeight);
var _clientwidth= document.documentElement.clientWidth || document.body.clientWidth;
//整个页面的高度
var _pageheight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
var msgtop = (scrolltop+((_clientheight)/2)+100)+"px";
var msgleft = (_clientwidth-200)/2+"px";
newDiv.style.top = msgtop;
newDiv.style.left =msgleft; // 屏幕居中
newDiv.style.background = "#CDCDCD";
newDiv.style.border = "1px solid #EFEFEF";
newDiv.style.padding = "5px";
newDiv.innerHTML = "正在获取Config,请稍等...";
document.body.appendChild(newDiv);
// 锁屏图层
var newMask = document.createElement("div");
newMask.id = overlayID;
newMask.style.position = "absolute";
newMask.style.zIndex = "998";
newMask.style.width = _clientwidth + "px";
newMask.sty
相关文档:
html:
<div id="slide-box">
<div id="slide">
<div id="fbshutter" style="width:1px;">
<img id="bPic" src="images/01.gif" /> </div>
  ......
js是弱类型的 但是某些时候 你还真需要一个date
比如说 指定时间 那么3个小时后是什么时间
这样的函数 自己写就麻烦了
转成Date
var hs = Date.parse('03/02/2009 22:10');
var d = new Date(hs);
document.write(d);
document.write('<br/>');
var h=3.5;
var arrh= ......