js源码--动态层

< style type = " text/css " >
body 
{
height:
100%;
}

.wc, #wc1, #wc2 
{
position:absolute;
border
-width:0px;
z
-index:2;
left:0px;
top:0px;
display:none
}

#wc1 
{
width:320px;
height:240px;
background
-color:#FFCC00;
}

#wc2 
{
width:420px;
height:340px;
background
-color:#CCCCCC;
}

.wc 
{
z
-index:1;
}

</ style >
< html >
< head >
</ head >
< body >
< div id = " wc1 " ></ div >
< div id = " wc2 " ></ div >
< center >
< button id = " show_wc1 " > show_wc1 </ button >
< button id = " show_wc2 " > show_wc2 </ button >
< div id = " id3 " ></ div >
  
< form name = " form1 "  method = " post "  action = "" >
    
< input type = " submit "  name = " Submit "  value = " 提交 " >
  
</ form >
  
< br  />
</ center >
</ body >
</ html >
< script language = " javascript " >
window.onload
= init;
function  init() {
div1
=document.getElementById("wc1")
div2
=document.getElementById("wc2")
button1
=document.getElementById("show_wc1")
button2
=document.getElementById("show_wc2")
add(div1,button1)
add(div2,button2)
}


function  add(o,p) {
o.style.display
="block";
o.top
=p.offsetTop+p.offsetHeight;
o.left
=p.offsetLeft+Math.ceil(p.offsetWidth/2);
o.style.left
=parseInt(o.left)-Math.ceil(o.offsetWidth/2)
o.style.top
=o.top
o.width 
= (o.offsetWidth) / 20;
o.height 
= (o.offsetHeight) / 20;
o.num 
= 0;
o.style.width
=0;
o.style.height
=0
o.style.display
="none";
p.onmouseover
=o.onmouseover=function(){move(o)};
p.onmouseout
=o.onmouseout=function(){out(o)};
}


function  move(o) {
window.clearTimeout(o.time)
window.status
=o.num
    
if (++o.num<=20){
        o.style.display
="block";
        o.style.width
=(o.num * o.width) + "px"
        o.style.height
=(o.num * o.height) + "px"
        o.style.left
=parseInt(o.left)-(o.offsetWidth/2)
        o.clear
=window.setTimeout(move, 10, o);
        }

    
else{
        window.clearTimeout(o.clear);
        }
    
}


function  out(o) {
window.clearTimeout(o.clear)
window.status
=o.num
if(--o.num>=0){
        o.style.width
=(o.num * o.width) + "px"
        o.style.height
=(o.num * o.height) + "px"
        o.style.left
=parseInt(o.left)-(o.offsetWidth/2)
        o.time
=window.setTimeout(out, 10, o);
        }

else{
        o.style.display
="none"
        window.clearTimeout(o.time);
        }
        
}



(
function  ()  {
var timeout = window.setTimeout;
window.setTimeout 
= function (a, b) {
var fun;
if ("function" == typeof a) {
var arg = Array.prototype.slice.call(arguments, 2);
fun 
= function () {
a.apply(
null, arg);
}
;
}
 else {
fun 
= a;
}

return timeout(fun, b);
}
;
}
)();

</ script >
clearTimeout一定要注意,可以测试类型来确定是否有值,在就是不能在onmouse等事件里放初始值,害的我研究了一下午,原来是放在mousemove等事件变量值随着改变 
mxblog博客系统 特性: 1. 使用ajax技术,单页面进行处理,ajax全部未使用微软控件,纯javascript编写,更轻量级。 2. 支持html5,兼容全部主流浏览器,包括firefox, chrome, IE, 搜狗, 360等。(兼容手机浏览器UC等) 3. 多种主流数据库支持,一套程序多种数据库间任意切换,支持 sql server. oracle. access. mysql。 4. 新增相册功能,多图批量上传,分类显示,可自动将图片生成为日志。 5. utf-8编码,更改配置就可以更换多国语言。 6. 重构程序结构,优化大量代码,程序结构更合理,执行效率更高。 7. 页面级缓存,访问速度更快。 8. 支持.net框架 4.0。 mxblog 3更新日志: 2014-07-22 v3.2.5.2 1, 增加文章简介自动重排功能,更新相应language.config。 2, 去除冗余引用。 2014-07-15 v3.2.5.1 1, 更新language.xml为language.config,更新config.xml为setting.config。 2, 是否启用GZip和editor的选择通过后台控制完成,不再需要调整配置文件。 2014-07-08 v3.2.5.0 1, GZip压缩不再使用第三方控件。 2014-07-03 v3.2.4.9 1, 页面标题更新。 2, 修改cache["Models_User"]bug。 3, 修改access_log语言插入异常bug。 2014-07-02 v3.2.4.8 1, 文章内容标题更新。 2, 扩充user表标题和描述字段长度为255。 3, 增加mate信息显示。 2014-06-24 v3.2.4.7 1, 图片浏览显示URL并支持IE自动将URL粘贴到客户端剪贴板。 2, 更新ckeditor皮肤,提供多种皮肤选择,并将ckeditor设置为默认编辑器。 3, 更新动态库版权信息,增加官网显示。 2014-06-23 v3.2.4.6 1, 可自助选择浏览器为ckeditor或fckeditor。 2, 更新mysql连接动态库。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值