浏览 2683 次
锁定老帖子 主题:firefox以及ie都兼容的相册播放器
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-07-10
<script type="text/javascript"> var adNum=0; var _Images=new Array(8); var adNum=0; var imgindex=1; _Images[0] = new Image(); _Images[0].src="http://q.yesky.com/pictures/2007/05/1591020_74591936.jpg"; _Images[0]=setImgSize(_Images[0]); imgindex++; _Images[1] = new Image(); _Images[1].src="http://q.yesky.com/pictures/2007/05/1591020_77091929.jpg"; _Images[1]=setImgSize(_Images[1]); imgindex++; _Images[2] = new Image(); _Images[2].src="http://q.yesky.com/pictures/2007/04/1591020_50424051.jpg"; _Images[2]=setImgSize(_Images[2]); imgindex++; _Images[3] = new Image(); _Images[3].src="http://q.yesky.com/pictures/2007/04/1591020_92004051.jpg"; _Images[3]=setImgSize(_Images[3]); imgindex++; _Images[4] = new Image(); _Images[4].src="http://q.yesky.com/pictures/2007/04/1591020_64983805.jpg"; _Images[4]=setImgSize(_Images[4]); imgindex++; _Images[5] = new Image(); _Images[5].src="http://q.yesky.com/pictures/2007/04/1591020_99503805.jpg"; _Images[5]=setImgSize(_Images[5]); imgindex++; _Images[6] = new Image(); _Images[6].src="http://q.yesky.com/pictures/2007/04/1591020_72235914.jpg"; _Images[6]=setImgSize(_Images[6]); imgindex++; _Images[7] = new Image(); _Images[7].src="http://q.yesky.com/pictures/2007/04/1591020_64505914.jpg"; _Images[7]=setImgSize(_Images[7]); imgindex++; <!-- var totel=8; //图片总数 var i=Math.floor(Math.random()*totel)+1; var play=0; function findObj(n, d){ var p,i,x; if(!d)d=document; if((p=n.indexOf("?"))>0 && parent.frames.length){ d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p); } if(!(x=d[n]) && d.all)x=d.all[n]; for(i=0; !x && i<d.forms.length; i++)x=d.forms[i][n]; for(i=0; !x && d.layers && i<d.layers.length; i++)x=findObj(n,d.layers[i].document); if(!x && d.getElementById)x=d.getElementById(n); return x; } function view(){ next(); viewtimeout(); } function viewtimeout(){ if(play==0){ setTimeout(function(){ view(); },parseInt(findObj('timeoutnum').value)*1000); } } function back(){ if(i==0)i=totel+1; i--; findObj('switch_photo').src=_Images[i].src; findObj('switch_photo').width=_Images[i].width; findObj('switch_photo').height=_Images[i].height; findObj('switch_photo_href').href=_Images[i].src; //findObj('pictext').innerHTML=imgTitle[i]; // findObj('q').value=i; } function next(){ if(i==totel-1)i=0; i++; findObj('switch_photo').src=_Images[i].src; findObj('switch_photo').width=_Images[i].width; findObj('switch_photo').height=_Images[i].height; findObj('switch_photo_href').href=_Images[i].src; //alert(_Images[i].src+"<>"+_Images[i].width+"*"+_Images[i].height); // findObj('pictext').innerHTML=imgTitle[i]; //findObj('q').value=i; } function go(){ if(findObj('q').value<totel+1 && findObj('q').value>0){ i=findObj('q').value; findObj('switch_photo').src=_Images[i].src; findObj('switch_photo').width=_Images[i].width; findObj('switch_photo').height=_Images[i].height; findObj('switch_photo_href').href=_Images[i].src; // findObj('pictext').innerHTML=imgTitle[i]; }else{ alert('error!'); } } function entergo(){ if(event.keyCode==13)eval('go()'); } function pageload(){ //findObj('pictext').innerHTML=imgTitle[i]; //findObj('q').value=i; } function imgload(){ document.write('<a href="" id="switch_photo_href" target="_blank"><img id="switch_photo" class="mgauto" src="'+_Images[i].src+'" width="'+_Images[i].width+'" height="'+_Images[i].height+'" border="0"/></a>'); } function setImgSize(img) { var maxWidth=240; var maxHeight=180; if(img.width > maxWidth) { var temp=maxWidth/img.width; img.width = maxWidth; img.height=img.height*temp; } if(img.height > maxHeight){ var temp1=maxHeight/img.height; img.height = maxHeight; img.width=img.width*temp1; } return img; } //--> </script> <div class="pd9 floatleft mgleft19 inline"><table><tr><td width="240" height="180" align="center"><script type="text/JavaScript">imgload();</script></td></tr></table></div> <div id="switcher" class="clear height29 "> <span class="floatleft mgleft11 "> <a href="javascript:void(0);" style="display:none;" id="viewstop" onclick="play=1;findObj('viewplay').style.display='';this.style.display='none';"> <img class="mgleft3 floatleft " src="/images/home/switch_pause.gif" width="20" height="20" alt="暂停" border="0" /></a> <a href="javascript:void(0);" id="viewplay" onclick="play=0;findObj('viewstop').style.display='';this.style.display='none';view();"> <img class="mgleft3 floatleft" src="/images/home/switch_stop.gif" width="20" height="20" alt="播放" border="0" /></a> <a href="javascript:void(0);" id="backs" onClick="back();"> <img class="mgleft3 floatleft" src="/images/home/switch_previous.gif" width="20" height="20" alt="上一个" border="0" /></a> <a href="javascript:void(0);" id="gtname" onClick="next();"> <img class="mgleft3 floatleft" src="/images/home/switch_next.gif" width="20" height="20" alt="下一个" border="0" /></a></span> <span class="floatright mgright5 pdtop5" > <a href="#" >查看所有相册>></a> <input type="hidden" id="timeoutnum" value="2"/> <script> play=0; findObj('viewstop').style.display=''; findObj('viewplay').style.display='none'; view(); </script> </span> </div> </div> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |