纯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>
<!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>
解决方案 »
- JS如何获取msql中的值?
- MD5可以给数据库加密么?
- 关于匿名函数和闭包的讨论
- 修正: jickie_liu 在 "请教字符串的编码形式?" 中的回复
- 请各位指点一下,使用insertAdjacentElement("beforeEnd",oNode)的问题
- IFrame中嵌套frameset时怎么用js进行控制,很急,在线等!!!
- 用javascript如何连接以有的xml文档,并把xml文档里的数据显示出来
- -------初学小菜:关于函数调用的问题!------
- 有没有办法读取frame中的页面源代码
- 2019大厂面试题,据说90%的人当场没写对,30%写出思路得了部分分数
- JS加载图片的问题
- javascript 问题 鼠标点击最后一行时自动生成一行
/* 页面切换效果 */
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 + ")"; } } } }