本文实例讲述了js实现同一页面可多次调用的图片幻灯切换效果。分享给大家供大家参考。具体实现方法如下:
复制代码 代码如下:<!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>js同一页面可多次调用的图片幻灯切换效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<script language="javascript">
//声明命名空间
var $o = new Object();
//基础方法
$o.base = {
e:function(a,f){
for(var i=0,j=a.length;i<j;i++){f.call(a[i],i);}
}
}
$o. slide = function (id,arg){
var arg = arg||{},
t = document.getElementById(id),
a = t.getElementsByTagName("a"),
lis = [],
cl = arg.color||'#f30',
ctm = arg.time*1000||2000,
w = t.clientWidth,
h = t.clientHeight,
b = ['<ul style="margin:0; padding:0; list-style:none; display:block; position:absolute; bottom:10px; right:10px;">'],
index = 0,
$ = null,
$ = null;
function change(i){
if(!!$){clearTimeout($);}
index = !isNaN(i)"px";
},30)
};
}
function c(b,o){
o.style.backgroundColor = !!b"#fff";
o.style.color = !!b"#fff":cl;
}
function st(){
if(!!$)clearTimeout($);
$ = setTimeout(function(){change()},ctm);
}
with(t.style){overflow = 'hidden';position = 'relative';}
$o.base.e(a,function(n){
this.style.display = "block";
with(this.firstChild.style){borderWidth = '0';width = w + 'px';height = h + 'px';}
b.push('<li style="width:20px; height:20px; line-height:20px; display:block; float:left; margin-left:5px; border:1px solid ' + cl + '; background-color:#fff; color:' + cl +'; font-size:14px; text-align:center; cursor:pointer;">' + (n+1) + '</li>');
});
b.push('</ul>');
t.innerHTML += b.join("");
lis = t.getElementsByTagName("li");
$o.base.e(lis,function(n){
if(n == index){c(1,this)}
this.onmouseover = function(){
if(n!=index)change(n);
}
});
st();
}
</script>
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<div id="aa" style="width:402px;height:228px;">
<a href="javascript:alert('1')"><img src="/UploadFiles/2021-04-02/1.jpg">
<a href="javascript:alert('2')"><img src="/images/2.jpg">
<a href="javascript:alert('3')"><img src="/UploadFiles/2021-04-02/3.jpg">
<a href="javascript:alert('4')"><img src="/images/4.jpg">
<a href="javascript:alert('5')"><img src="/UploadFiles/2021-04-02/5.jpg">
<a href="javascript:alert('6')"><img src="/images/6.jpg">
<a href="javascript:alert('7')"><img src="/UploadFiles/2021-04-02/7.jpg">
<a href="javascript:alert('8')"><img src="/images/8.jpg">
<a href="javascript:alert('9')"><img src="/UploadFiles/2021-04-02/9.jpg">
</div>
<script language="javascript">
new $o.slide("aa");
</script>
<br>
<div id="bb" style="width:402px;height:228px;">
<a href="###"><img src="/UploadFiles/2021-04-02/1.jpg">
<a href="###"><img src="/images/2.jpg">
<a href="###"><img src="/UploadFiles/2021-04-02/3.jpg">
<a href="###"><img src="/images/4.jpg">
<a href="###"><img src="/UploadFiles/2021-04-02/5.jpg">
</div>
<script language="javascript">
new $o.slide("bb",{color:'#000',time:0.2});
</script>
<br>
<div id="cc" style="width:402px;height:228px;">
<a href="###"><img src="/UploadFiles/2021-04-02/1.jpg">
<a href="###"><img src="/images/2.jpg">
<a href="###"><img src="/UploadFiles/2021-04-02/3.jpg">
<a href="###"><img src="/images/4.jpg">
<a href="###"><img src="/UploadFiles/2021-04-02/5.jpg">
</div>
<script language="javascript">
new $o.slide("cc",{color:'green'});
</script>
</body>
</html>
希望本文所述对大家的javascript程序设计有所帮助。
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?