JS 图片幻灯播放效果
JS 图片幻灯播放效果
By
admin
at 2007-10-19
0人收藏 • 1027人看过
<SCRIPT> var picInfos = new Array(10); picInfos[0]='http://www.jiee.cn/images/test1.jpg`@^2妈阿!想撑死我阿...`@^05年6月18日`@^幽默一笑`@^308214`@^10620`@^446`@^321' picInfos[1]='http://www.jiee.cn/images/test2.jpg`@^6最色的东西`@^05年6月18日`@^幽默一笑`@^308213`@^10620`@^309`@^359' picInfos[2]='http://www.jiee.cn/images/test1.jpg`@^汤加丽1`@^05年6月17日`@^好地方`@^308093`@^10620`@^802`@^1100' picInfos[3]='http://www.jiee.cn/images/test2.jpg`@^888`@^05年6月17日`@^DD.JJ.MM`@^307972`@^10620`@^120`@^81' picInfos[4]='http://www.jiee.cn/images/test1.jpg`@^清纯`@^05年6月17日`@^DD.JJ.MM`@^307950`@^10620`@^400`@^533' picInfos[5]='http://www.jiee.cn/images/test2.jpg`@^我眼中的上最新规划图`@^05年6月17日`@^jianliuer`@^307854`@^10620`@^1500`@^1051' picInfos[6]='http://www.jiee.cn/images/test1.jpg`@^最新官方上海世博规划`@^05年6月17日`@^jianliuer`@^307853`@^10620`@^1500`@^1051' picInfos[7]='http://www.jiee.cn/images/test2.jpg`@^image0033`@^05年6月16日`@^ylhr_sun`@^307690`@^10620`@^800`@^532' picInfos[8]='http://www.jiee.cn/images/test1.jpg`@^image0022`@^05年6月16日`@^ylhr_sun`@^307689`@^10620`@^800`@^532' picInfos[9]='http://www.jiee.cn/images/test2.jpg`@^image0011`@^05年6月16日`@^ylhr_sun`@^307688`@^10620`@^800`@^600' </SCRIPT> <style type="text/css"> span {cursor:pointer;} td {font-size:12px;} </style> <CENTER> <TABLE borderColor="#f99f0b" cellSpacing="2" cellPadding="0" width="764 " bgColor="#ffe386" border="3"> <TR> <TD bgColor=#ffffff> <TABLE cellSpacing=0 cellPadding=0 width=760 border=0> <TR> <TD align=right bgColor=#ffc705> <span onclick="previous()">上一张</span> <span onclick="next()">下一张</span> <span onclick="startSlide()">播放</span> 间隔 <SELECT onchange=chgInterval(this.value)> <OPTION value=3000 selected>3秒</OPTION> <OPTION value=5000>5秒</OPTION> <OPTION value=8000>8秒</OPTION> <OPTION value=10000>10秒</OPTION> </SELECT> </TD> </TR> </TABLE> <TABLE borderColor=#ffffff cellSpacing=0 cellPadding=0 width=760 border=1> <TR> <TD id=picArea align=middle width=580 bgColor=#ffc705> <IMG src="http://www.jiee.cn/images/test2.jpg" border=0> </TD> <TD id=picInfoArea style="LINE-HEIGHT: 160%" vAlign=top bgColor=#ffc705></TD> </TR> </TABLE> <TABLE height=9 cellSpacing=0 cellPadding=0 width=760 border=0> <TR> <TD style="WORD-WRAP: break-word" align=middle bgColor=#ffc705> <BR><SPAN id=start></SPAN><SPAN id=line></SPAN><SPAN id=end></SPAN> </TD> </TR> </TABLE> </TD> </TR> </TABLE> </CENTER> <SCRIPT> var isLogin = false var isClassMember = false var isClassGuest = false var picSums = picInfos.length; var cursor = 0; function previous() { stopSlide(); if (cursor < 1) return; cursor--; showPic(); } function next() { stopSlide(); if (cursor >= picSums-1) return; cursor++; showPic(); } var BARS = 30; function paintBar() { document.getElementById("start").innerText = Math.floor(cursor/BARS)*BARS + 1; var output = ""; var i = 0; for (; i<BARS && i<picSums-Math.floor(cursor/BARS)*BARS; i++) { output += "<font color=#888888 id=f" + i + "><b>|</b></font>"; } document.getElementById("line").innerHTML = output; document.getElementById("f" + cursor%BARS).style.color = "#ff0000"; document.getElementById("end").innerText = Math.floor(cursor/BARS)*BARS + i; } function showPic() { pic = picInfos[cursor].split("`@^"); document.all.picArea.innerHTML = "<a href=/photoshow/" + pic[5] +"/"+pic[4]+".html target=_blank><img id=photoShow src=\"" + pic[0] + "\" border=0 onclick=stopSlide() onmousewheel='return zoomimg(this)' "+showImgSize2(pic[6],pic[7])+"></a>"; document.all.picInfoArea.innerHTML = "<BR> 名称:<a href=/photoshow/"+pic[5]+"/"+pic[4]+".html target=_blank>" + pic[1] + "</a><br>" + " 作者:" + pic[3] + "<br>" + " 时间:" + pic[2] + "<br><BR><BR><BR><BR><BR><BR><BR>" + " <a href=/photoshow/"+pic[5]+"/"+pic[4]+".html target=_blank>点击看大图</a><br>"+" <a href=http://sh.focus.cn/group/photoshow/"+pic[5]+"/"+pic[4]+".html target=_blank>点评图片</a>"; paintBar(); } var area_w = 600; var area_h = 450; function showImgSize2(img_width,img_height) { var new_w = new_h = 0; ori_w = img_width; ori_h = img_height; area_w = 600; area_h = 450; if(ori_w > area_w) {new_w = area_w; new_h = (area_w * img_height)/img_width;} else {new_w = ori_w; } if(ori_h > area_h) {new_h = area_h; new_w = (area_h * img_width)/img_height;} else {new_h = ori_h;} return " width=" + new_w + " height=" + new_h; } function zoomimg(img){ var zoom=parseInt(img.style.zoom,10) || 100; zoom += event.wheelDelta / 24; imgW = document.getElementById("photoShow").clientWidth*zoom/100; if (zoom>10 && imgW<area_w) img.style.zoom = zoom + "%"; return false; } function showImgSize() { if(document.getElementById("photoShow").clientWidth>area_w) { document.getElementById("photoShow").width=600; } if(document.getElementById("photoShow").clientHeight>area_h) { document.getElementById("photoShow").height=650; } } var interval = 3000; var oInterval = ""; function startSlide() { cursor++; if (cursor > picSums-1) cursor = 0; showPic(); if (oInterval=="") oInterval = setInterval("startSlide()", interval); } function stopSlide() { window.clearInterval(oInterval); oInterval = ""; } function chgInterval(ch_interval){ stopSlide() interval = ch_interval; startSlide() } if (oInterval=="") oInterval = setInterval("startSlide()", interval); </SCRIPT> <SCRIPT>showPic();</SCRIPT> <SCRIPT>paintBar();</SCRIPT>
提示:你可先修改部分代码,再按运行
JS
图片幻灯播放
登录后方可回帖
1 个回复 | 最后更新于 2008-06-28
178911360
2008-06-28
#1
强锕~~~~~~~~~~~~~~~~~~~~~~~~~~~~
首页
话题广场
搜索
登 录
登 录
现在注册
桌面模式
登 录
现在注册