runxinzhi.com
首页
百度搜索
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
相关阅读:
CentOS 6.6 下源码编译安装MySQL 5.7.5
CentOS 6.6下安装配置Tomcat环境
Redhat6.7 切换Centos yum源
css盒模型
mysql 查询表占用空间大小
ligerform 控件元素设置为只读
FtpClient中文文件名下载失败问题
java Runtime.exec() 执行问题
java log4j动态生成log文件
java udp地址匹配
原文地址:https://www.cnblogs.com/Dicky/p/456336.html
最新文章
ride.py在运行python3.×版本后导致无法运行及解决办法
MYSQL 模糊查询
HTTP状态码及其含义
update
用substr()截取中文出现乱码的解决方法
@Autowired与@Resource的区别
什么时候用过滤器,什么时候使用拦截器。
什么是Java虚拟机?为什么Java被称作是“平台无关的编程语言”?
pandas数据分析-处理填充缺失数据
pandas_datareader下载雅虎财经股价数据
热门文章
Python实现Zabbix图文告警
TestDFSIO基准测试HDFS
加深Java重写父类方法的理解
浅谈简单工厂模式--工厂方法模式--抽象工厂模式的不同
工具之wc
工具之sort
工具之awk
工具之grep
工具之sed
工具之cut
Copyright © 2020-2023
润新知