<div id="myscroll" style="height:50px;overflow:hidden; margin-top:14px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="51" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"><img src="/Upload/14202816361243314.jpg" width="120" height="50" /></td>
<td width="10"> </td>
<td width="120"> </td>
</tr>
</table>
</div>
<div id="showhint"></div>
<script type="text/javascript">
function $(element){
if(arguments.length>1){
for(var i=0,length=arguments.length,elements=[];i<length;i++){
elements.push($(arguments[i]));
}
return elements;
}
if(typeof element=="string"){
return document.getElementById(element);
}else{
return element;
}
}
var Class={
create:function(){
return function(){
this.initialize.apply(this,arguments);
}
}
}
Function.prototype.bind=function(object){
var method=this;
return function(){
method.apply(object,arguments);
}
}
var Scroll=Class.create();
Scroll.prototype={
initialize:function(element,height){
this.element=$(element);
this.element.innerHTML+=this.element.innerHTML;
this.height=height;
this.maxHeight=this.element.scrollHeight/2;
this.counter=0;
this.scroll();
this.timer="";
this.element.onmouseover=this.stop.bind(this);
this.element.onmouseout=function(){this.timer=setTimeout(this.scroll.bind(this),1000);}.bind(this);
},
scroll:function(){
if(this.element.scrollTop<this.maxHeight){
this.element.scrollTop++;
this.counter++;
}else{
this.element.scrollTop=0;
this.counter=0;
}
if(this.counter<this.height){
this.timer=setTimeout(this.scroll.bind(this),20);
}else{
this.counter=0;
this.timer=setTimeout(this.scroll.bind(this),3000);
}
},
stop:function(){
clearTimeout(this.timer);
}
}
var myscroll=new Scroll("myscroll",50);
</script>
上面的这段代码是让图片向上滚动,但是一开始图片就向上滚动,我想要图片一开始不滚动,停留3000ms以后再滚动,我对js不太熟,请教大家要如何修改这段代码才能达到我想要的效果