纯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>
解决方案 »
- Jquery 如何根据相同的元素进行排序
- 得到一个div下 特定ID的所有标签。。。
- mxGraph grapheditor 画流程图
- 求助jquery tokeninput 自动补全插件相关问题
- 为什么(?<=:\s*)(\b\w+\b)无法匹配 hinting: roll中的roll求救?
- 关于点击“保存”按钮之前的判断
- 请教如何看这个网站的脚本代码?
- 做了个Table 的Row拖动,有兴趣的来看看
- ssm1226(雨中人)进来取分
- myeclipse运行程序出现500错误,该怎么解决?错误如下,项目为网上商城
- 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 + ")"; } } } }