分享
 
 
 

&#106avascript图片播放类ImageSlide.iclass.js

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

演示见此: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;

}

//显示

ImageSlide.prototype.display = function () {

var boxStr = "<div style='width:" + this.width + "px;height:" + this.height + "px;' ";

boxStr += "id='" + this.boxId + "'><div ";

if (this.autoPlay)

boxStr += "onclick='window.imageSlide.play();window.imageSlide.timerPlay();'";

else

boxStr += "onclick='window.imageSlide.play();'";

boxStr += "style='word-break:keep-all;width:100%;height:100%;background-color:#EEEEEE;'>";

if (this.autoPlay)

boxStr += "<br />点击此处开始进行自动播放……";

else

boxStr += "<br />点击此处开始播放,播放时单击播放下一张……";

boxStr += "</div>";

var img;

var transform = this.transform;

for (var i = 0; i < this.imgs.length; i++) {

if (this.transform >= 23)

var transform = Math.floor(Math.random()*23);

boxStr += "<img src='" + this.imgs[i] + "' style='display:none;width:";

boxStr += this.width + ";height:" + this.height + "px;height:px;filter:";

boxStr += "revealTrans(transition=" + transform + ",duration=1);'";

if (!this.autoPlay)

boxStr += "' onclick='window.imageSlide.play();' alt='点击播放下一张'";

boxStr += " />";

}

boxStr += "</div>";

document.writeln(boxStr);

var box = document.getElementById(this.boxId);

this.first = box.childNodes[0];

this.frms = box.getElementsByTagName("IMG");

}

//播放

ImageSlide.prototype.play = function () {

if (window.imageSlide.imgs.length) {

window.imageSlide.first.style.display = "none";

if (window.imageSlide.count >= window.imageSlide.imgs.length) {

alert("播放完毕!");

window.imageSlide.frms[window.imageSlide.count-1].style.display = "none";

window.imageSlide.first.style.display = "block";

window.imageSlide.first.innerHTML = "<br />点击此处再次进行播放!";

clearInterval(window.imageSlide.timer);

window.imageSlide.count = 0;

}

else if (window.imageSlide.count == 0) {

window.imageSlide.first.style.display = "none";

window.imageSlide.frms[0].filters[0].apply();

window.imageSlide.frms[0].style.display = "block";

window.imageSlide.frms[0].filters[0].play();

}

else {

window.imageSlide.frms[window.imageSlide.count-1].style.display = "none";

window.imageSlide.frms[window.imageSlide.count].filters[0].apply();

window.imageSlide.frms[window.imageSlide.count].style.display = "block";

window.imageSlide.frms[window.imageSlide.count].filters[0].play();

}

window.imageSlide.count++;

}

else {

alert("你没有放入任何图片,无法进行播放!");

}

}

//连续播放

ImageSlide.prototype.timerPlay = function () {

this.timer = setInterval(this.play, this.delay * 1000);

}

//实例化一个ImageSlide对象imageSlide并将其做为window对象的一个子对象

window.imageSlide = new ImageSlide();

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有