图片透明渐变轮番显示的脚本效果


图片以透明渐变轮番显示的脚本效果,过去也有过类似的,可是不能任意的定制增减图片的数量,这次的是完美的。
  制作方法:
  在<head>标签下,粘贴代码:
<SCRIPT LANGUAGE="JavaScript">
// 设置轮番显示速度 Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// 匀滑转换时间 Duration of crossfade (seconds)
var crossFadeDuration = 3;
// 指定图像文件 Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = '1.jpg'
Pic[1] = '2.jpg'
Pic[2] = '3.jpg'
Pic[3] = '4.jpg'
Pic[4] = '5.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
</script>
  修改body:
  <body bgcolor="#FFFFFF" text="#000000" onLoad="runSlideShow()">
  将表格单元格设置名称“id=VU”:
  <td id=VU>
  在<img>中加入代码:<img src="http://www.blue1000.com/article/1.jpg" name='SlideShow'>

  至此,我们的效果便制作好了,你不仿试试! 本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3