转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 网络应用 >> 正文
Javascript图片播放类ImageSlide.iclass.js         

Javascript图片播放类ImageSlide.iclass.js

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1832 更新时间:2007/11/8 19:40:10
 

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


[C语言系列]c# _winform实现网页上用户自动登陆,模拟网站登录  [C语言系列]C#用Web Services制作的升级程序
[Web开发]巧妙运用PHP函数实现采集器的制作  [互联动态]网页防复制代码
[网页制作]网页自动跳转代码大集合[站长常用代码集合]  [网页制作]用IFRAME实现网页的内嵌和预载
[办公软件]如何在office(PowerPoint,Word,Excel)中制作带圈的…  [办公软件]利用PowerPoint绘图翻转功能制作(镜像)倒影艺术字
[办公软件]如何通过网页打开PPT  [办公软件]如何在PowerPoint中制作模板并使用模板
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · 电脑应用  · 网络应用
    · 软件开发  · 软件使用
    · 站长学院  · 数据库
    · 应用范文  · 网络书斋
    · 考试认证  · 精彩网文
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台