.

JS实现图片轮换效果
分类:电脑知识 发表于:2010-10-07 11:43:14 评论(4)


在网上借用了个JS实现图片轮换效果代码,存起来先。

经测试,火狐下也可用。不过火狐下不能在本页点击查看效果。

图片可自行增减,但在var pics/links/texts处需做相应修改。

代码如下:

<script type="text/javascript">

imgUrl1="images/tuya/001.jpg";

imgtext1="那时候美少女战士很火。。。";

imgLink1=escape("http://链接地址");

imgUrl2="images/tuya/006.jpg";

imgtext2="貌似是上课时压课本底下画的";

imgLink2=escape("http://链接地址");

imgUrl3="images/tuya/010.jpg";

imgtext3="照某个明星脸画的,可没人认得出来呃...";

imgLink3=escape("http://链接地址");

imgUrl4="images/tuya/009.jpg";

imgtext4="画的时候贼奇怪了,人怎么比车大那么多。。。";

imgLink4=escape("http://链接地址");

imgUrl5="images/tuya/014.jpg";

imgtext5="最喜欢的一张,好酷的感觉~~~";

imgLink5=escape("http://链接地址");

var focus_width=300

var focus_height=300

var text_height=30

var swf_height = focus_height+text_height

var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5

var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5

var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5

document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');

document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="pic/2010/10100701.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');

document.write('<param name="menu" value="false"><param name=wmode value="opaque">');

document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');

document.write('<embed src="pic/2010/10100701.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');

</script>

  
邮箱: 密码:
  • Lvtu (2010-10-08 08:15:59)
    你还没睡醒呀,这是“运行代码”? 。。。。。。。。 得之,我幸;失之,我命。如是而已!
    • 阿和 博主 (2010-10-08 08:44:15)
      是你还没睡醒吧?[jy] 没把鼠标放在代码上?没看到点击查看效果? 
  • Lvtu (2010-10-07 22:02:30)
    不错,有前途,知道试多几个浏览器! 不过有点汗的是为什么不截个效果图放在上面呀? 得之,我幸;失之,我命。如是而已!
    • 阿和 博主 (2010-10-07 22:21:56)
      吖真难伺候啊,以前让我搞个运行代码功能的是你,现在又说截效果图!