Banner展示类TBanner(2) in JScript[1]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 dragonimp 的 blog

名称:tbanner
功能:在同一位置展示多张图片链接,图片链接之间采用某种效果切换
      同一个页面可以显示多个这样的banner,互不影响
特点:使用简单
类名:tbanner
方法:init(basepath,images,urls) //basepath为图像所在的目录
                                 //images是图像文件名数组
                                 //urls是每个图片所对应链接地址数组,如果少于图片数,则用第一个地址代替
      seteffect(filter,fneffect)//filter是滤镜名及参数,
                //fneffect是名部函数,原型是fneffect(obj),obj是显示的图片对象
                  这个函数可在外部改变滤镜参数,以使每次作用效果不同
      start(delay)//开始自动播放图片链接,delay是每张图片切换间隔时间,ms为单位
      stop()      //停止自动切换图片及链接
      play()      //切换一次图片链接,同时播放效果,一般不用
    
例子:
 var banner_example=new tbanner();//声明一个对像banner_example,然后调用init初始化 
 banner_example.init("images/",//图象基地址
   new array("r0.gif","r1.gif"), //图象名
   new array("http://www.impx.net")); //对应图片链接
 //banner.seteffect("progid:dximagetransform.microsoft.fade(duration=2)");//设置新的效果,没有则调用默认的
 banner_example.start(2000);//开始,设置图片切换的间隔时间2秒

演示地址:http://impx.net/scripts/tbanner.htm

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");

本文关键:Banner展示类TBanner(2) in JScript
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top