纯JS ,发一个区块切换效果,欢迎修改

三散人 2010-08-27 04:03:48
纯JS ,发一个区块切换效果,欢迎修改,不用JQ插件


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>this is event test</title>
<style>
#test1 {cursor:pointer;}
</style>
<script type="text/javascript" language="javascript">
/* 页面切换效果 */
function JumpDiv(id) { window.obj = this; this.Did = id; this.Count = 0; this.Jump = function() { obj.Count = obj.Count + 5; if (obj.Count < 100) { setTimeout("obj.Jump()", 1); var o = document.getElementById(obj.Did); if (o) { var str = "Alpha(opacity=" + this.Count + ")"; o.style.filter = str; } } } }

function test(o){
if(o){
var i=Math.floor(Math.random()*1000+100);
var j=new JumpDiv(o.id);
o.innerHTML=i;
j.Jump();
}

}

</script>
</head>
<body onselectstart="return false">
<h1 id="test1" onclick="test(this)">test is start</h1>
</body></html>
...全文
194 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyujie 2010-08-27
  • 打赏
  • 举报
回复
三散人 2010-08-27
  • 打赏
  • 举报
回复
这个兼容FF


/* 页面切换效果 */
function JumpDiv(id) { window.obj = this; this.Did = id; this.Count = 5; this.Jump = function() { obj.Count = obj.Count + 5; if (obj.Count < 100) { setTimeout("obj.Jump()", 1); var o = document.getElementById(obj.Did); if (o) { if(navigator.userAgent.indexOf("Firefox") > -1) o.style.opacity = this.Count /100 ; else o.style.filter = "Alpha(opacity=" + this.Count + ")"; } } } }

draglonglong 2010-08-27
  • 打赏
  • 举报
回复
很好很强大~~~~学习收藏。。。

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧