zoukankan
html css js c++ java
JS实现图片幻灯片效果
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>JS实现图片幻灯片效果</TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <BODY> <div align="center"><div id=AdRotator></div><input id="second"><button onclick="adRotator.set(getRef('second').value)">set time</button></div> <SCRIPT LANGUAGE="JavaScript"> <!-- function adRotator() {}; adRotator.initialize=function(o) { // script by blueDestiny this._t = new Array(); this._l = new Array(); this._p = new Array(); this._i = new Image(); this._c = 0; this._f = false; this._o = o; this._timeout = null; this._html = ""; // configration. // @ image width // @ image height // @ rotator speed // @ filter type this._w = 450; this._h = 450; this._s = 4; this._x = 23; return this; }; adRotator.add=function(p,t,l) { with (this) { _p.push(p); _t.push(t); _l.push(l); }}; adRotator.load=function() { with (adRotator) { if( _i.readyState=='complete' ) { if(_p.length-1==_c) { _f = true; _c = 0; window.clearTimeout(_timeout); //getRef("AdRotator").innerHTML="complete"; adRotator.play(); } else { _c++; getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "..."; _timeout=window.setTimeout(adRotator.load,10) } } else { getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "..."; _timeout=window.setTimeout(adRotator.load,10) } }}; adRotator.play=function() { with (adRotator) { if( _f ) { _html = ""; _html += '<table style="border:1px solid #333333;"><tr><td style="font-size:9pt;font-family:tahoma;font-weight:bold;">' _html += '<div id="rotatorPlayer"' + ' style="' + _w + '' + ';height:"' + _h + '"' + '>' _html += '<a href="' + ( _l[_c] ? _l[_c] : "javascript:void(0);" ) + '">'; _html += '<img id="rotatorPic" src="' + _p[_c] + '"' + ' width="' + _w + '"' + ' height="' + _h + '"' + (_t[_c]?' title="' + _t[_c] + '"':'') + ' style="border:1px solid blue;FILTER:revealTrans(transition=' + _x + ',duration=1);"' + ' >'; _html += (_t[_c]?('<div align="center">' + (_c+1) + '. ' + _t[_c] + '</div>'):'<p></p>'); _html += '</a>'; _html += "</div>"; _html += '<div align="right">'; for(var i=0; i<_p.length; i++) _html += '<span' + ' style="border:1px solid #333333;padding:1px 5px 1px 5px;height:20px;text-align:center;cursor:' + (_c==i ? ('default;background-color:red;"') : 'hand;" onclick="adRotator.select(' + i + ')"') + '>' + (i>8?(i+1):('0'+(i+1)))+ '</span> '; _html += "</div></td></tr></table>"; getRef(_o).innerHTML = _html; getRef("rotatorPic").filters[0].Apply(); getRef("rotatorPic").filters[0].Play(); next(); } else { _i.src = _p[_c]; adRotator.load(); } }}; adRotator.next=function() { with (this) { (_p.length-1==_c) ? _c=0 : _c++; _timeout=window.setTimeout(adRotator.play,_s*1000); }}; adRotator.select=function(i) { with (this) { window.clearTimeout(_timeout); _c=i; adRotator.play(); }}; adRotator.set=function(second) { with (this) { window.clearTimeout(_timeout); if((/\d+/).test(second)==true) { _s=second; adRotator.play(); } else { alert("must be digit!") adRotator.play(); } }}; function getRef(id) { return (document.all?document.all(id):document.getElementById(id)); } adRotator.initialize("AdRotator"); adRotator.add("http://img1.qq.com/ent/20060218/3215110.jpg","aa","http://www.blueidea.com") adRotator.add("http://img1.qq.com/ent/20060218/3215111.jpg") adRotator.add("http://img1.qq.com/ent/20060218/3215112.jpg") adRotator.add("http://img1.qq.com/ent/20060218/3215113.jpg") adRotator.add("http://img1.qq.com/ent/20060218/3215114.jpg") adRotator.play(); //--> </SCRIPT> </BODY> </HTML>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
青苹果Web应用商店
https://webapp.taobao.com/
PHP/ASP.NET/ASP/UCHOME/DISCUZ! X系列网站开发,详细需求联系
QQ:8511978
查看全文
相关阅读:
mysql查询字段取前3位,后3位,中间3位,去除前3位,去除后3位
10月份四季度
JavaScript箭头函数的立即执行函数实现三元表达式执行多条语句
JavaScript判断是否是同一天
项目经理:是兄弟就一起加班吧
技术人员转型项目经理的角色转换
项目经理入职后,如何快速管理项目
如何解决项目成员之间的冲突?
提高各方面沟通效率,是项目经理该去做的事
项目计划太复杂?试试思维导图
原文地址:https://www.cnblogs.com/Dicky/p/456336.html
最新文章
Sharding-Sphere 水平分表
前端请求流文件接口responseType: 'blob'
子元素背景设置透明,背景为父元素
el-select 获取change点击index
node使用 http-proxy进行转发
element-ui cascader 重置按钮触发清空操作
两个文本、或两个字符串对比改变的字段高亮标红显示
论宇宙的非计算式构成
百度AI人体分析接口调用自动化脚本
Python简易闹钟:全屏置顶弹窗提醒
热门文章
完成存在的价值就是去实现他人不可复刻的成果
使用IdentityServer4简单的实现一个SSO登录
.NET Core2.0+MVC 用session,cookie实现的sso单点登录
什么是单点登录(原理与实现简介)
netCore如何操作多个数据库,可以用Dapper
如何避免IIS进程回收
微信H5支付返回“商户号该产品权限预开通中,请等待产品开通后重试”
HTTP Error 502.5
C# 时间与时间戳互转的方法(13位)
MySQL时间转换(timestamp与date互转)
Copyright © 2011-2022 走看看