演示见此:http://www.iecn.net/iclass/js/imageslide/
打开后,右健,查看源码即可看到调用的实例。
源码如下:
/**
* =========================================================================
* 本程序可自由复制、修改、传播,不得删除以下信息。如用于商业用途须经原作者同意方可使用。
* =========================================================================
* 程序名称:forcewindow(@iclass.js)
* 描 述:网页上的图片幻灯片。
* 版 本:1.0.0
* 创建时间:2005年4月23日
* 修改时间:2005年4月23日
* 作 者:钟钟
* 邮箱地址:zhong@iecn.net
* 版权声明:本程序属于iclass.js,版权归作者所有。
* 讨论地址:http://www.iecn.net/forum/showthread.php?threadid=16975
* 有关iclass计划详见:http://www.iecn.net/forum/showthread.php?threadid=14811
* =========================================================================
*/
//构造imageslide类
function imageslide () {
if((/msie\s*[5-9]/).test(navigator.appversion)) {
this.count = 0;
this.timer = null;
this.first = new object();
this.frms = new array();
this.imgs = new array();
this.width = 640;
this.height = 480;
this.boxid = "imageslidebox";
this.delay = 5;
this.autoplay = true;
this.transform = 23;
/**
* 播放切换效果说明
* --------------
* 0. 矩形缩小
* 1. 矩形扩大
* 2. 圆形缩小
* 3. 圆形扩大
* 4. 从下到上
* 5. 从上到下
* 6. 从左到右
* 7. 从右到左
* 8. 竖百叶窗
* 9. 横百叶窗
* 10. 错位横百叶窗
* 11. 错位竖百叶窗
* 12. 点扩散
* 13. 两边到中间
* 14. 中间到两边
* 15. 中间到上下
* 16. 上下到中间
* 17. 右下到左上
* 18. 右上到左下
* 19. 左上到右下
* 20. 左下到右上
* 21. 横条
* 22. 竖条
* 23. 随机
* --------------
*/
}
else {
alert("请使用ie5或ie5以上版本的浏览器使用本程序!");
}
}
//加入一张或多张图片(传入一个或多个图片路径)
//pushimg(spath1 [, spath2 [, spath3 [, ...]]])
imageslide.prototype.pushimgs = function () {
for (var i = 0; i < arguments.length; i++)
this.imgs.push(arguments[i]);
}
//设置图片播放容器的长宽
imageslide.prototype.setsize = function (nwidth, nheight) {
this.width = nwidth;
this.height = nheight;
}
//设置图片播放容器的id
imageslide.prototype.setboxid = function (sboxid) {
this.boxid = sboxid;
}
//设置是否自动播放
imageslide.prototype.setautoplay = function (bautoplay) {
this.autoplay = bautoplay;
}
//设置自动播放的延时秒数
imageslide.prototype.setdelay = function (nseconds) {
this.delay = nseconds;
}
//设置播放的切换效果(0-23的整数)
imageslide.prototype.settransform = function (ntransform) {
this.transform = ntransform;
}