本代码描述: 这个代码很很简单,不用js、flash,全部htm代码! 来访者可以自己设置图片轮播的秒数。 预览效果!<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>好我要网自设定时间的轮播代码 </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)">设定秒数</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 = 403; this._h = 243; 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="width: + _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("/user/tool/imag/flash01.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash02.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash03.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash04.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash03.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash01.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash02.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash03.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash04.jpg","好我要网","http://bbs.hao51xx.com") adRotator.add("/user/tool/imag/flash03.jpg","好我要网","http://bbs.hao51xx.com") adRotator.play(); //--> </SCRIPT> </BODY> </HTML> 复制代码另存代码收藏本页 帮助
提示:部分代码需要到这里测试才能看见完整效果!
在中搜索:“可设置切换时间的图片广告代码”更多内容在中搜索:“可设置切换时间的图片广告代码”更多内容
CopyRight© 2008-2009 hao51xx.com, 本站部分资源来于网络,版权文责归原作者,对于任何事宜本站将在第一时间处理。