tbanner(2) in jscript
posted on saturday, february 12, 2005 11:28 pm/*重新写了一下这个类,把原来几个函数都移了进去,并且加一个seteffect用来设置滤镜和效果!这样就可以从外部编写函数来增强效果了!并且不用再把对象名传递给类了!保留了对原来的兼容,对外只增加一个seteffect,当然还有play和stop。
演示地址:http://impx.net/scripts/tbanner.htm
*/
/*=============================
copyright by dragonimp
all rights reserved.
description:class for tbanner
version0.1 2004.8.26 first thought to make a class for banner
version1.0 2004.11.24 simple function to support a banner
version1.1 2004.12.10 basic effect in class
version1.2 2005.2.6 seteffect to add other filters and effects
email:dragonimp@impx.net
homepage:http://www.impx.net
==============================
//usage:(4 steps to run a banner)
0. first of all, you should include this file in your source.
1. new tbanner to initialize a new tbanner object
2. init the base path of images, names of images, and urls for links. first as default;
3. seteffect to play unique effection. if omitted, it will play with default effection.
4. start with interval time.
//example:
var banner_example=new tbanner();
banner_example.init("/images/rotate/",new array("r1.gif","r2.gif","r3.gif"),new array("url1","url2","url3"));
//banner_example.seteffect("progid:dximagetransform.microsoft.gradientwipe(duration=1.5,gradientsize=0.75,motion=forward)",null)
//banner_example.seteffect("revealtrans(duration=2.0,transition=1)",function(obj){obj.filters[0].transition = math.floor(math.random() * 23);})
banner_example.start(5000);//millisecond
==============================*/
function tbanner()
{
//create a contianer
//====================================
this.container=document.createelement("div");
//document.body.appendchild(this.banner); this cannot work at unstandard env.
var contianerid="tbannercontainer_"+this.container.uniqueid;
document.write("<div id='"+contianerid+"'></div>");
delete this.container;
this.container=eval(contianerid);
this.image=window.document.createelement("img");