firefox以及ie都兼容的相册播放器

[code]<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" οnclick="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" οnclick="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>
[/code]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值