加个鼠滑过,停止播放的效果?

ChrisXChen 2010-01-27 03:49:14
var widths=1003; /*显示高度*/
var heights=250; /*显示宽度*/
var counts=3;
img1=new Image ();img1.src='/images/banner01.jpg';
img2=new Image ();img2.src='/images/banner03.jpg';
img3=new Image ();img3.src='/images/banner02.jpg';



url1=new Image ();url1.src='index.asp';
url2=new Image ();url2.src='index.asp';
url3=new Image ();url3.src='index.asp';

//
var nn=1;
var key=0;
function change_img(){
if(key==0){
key=1;
}else if(document.all){
document.getElementById("slidepic").filters[0].Apply();
document.getElementById("slidepic").filters[0].Play(duration=2);
}
eval('document.getElementById("slidepic").src=img'+nn+'.src');
eval('document.getElementById("slideurl").href=url'+nn+'.src');
for (var i=1;i<=counts;i++){
document.getElementById("slide"+i).className='slide';
}
document.getElementById("slide"+nn).className='slideover';
nn++;
if(nn>counts){nn=1;}
tt=setTimeout('change_img()',8000);
}

//
function changeimg(n){nn=n;window.clearInterval(tt);change_img();}
document.write('<style type="text/css">');
document.write('.slide{border:#fff 1px solid; padding:1px; display:block; width:15px; height:15px; text-align:center;}');
document.write('a.slide{text-decoration:none;color:#888;font:9px sans-serif;background-color:#FC0; display:bolck; float:left;line-height:15px;}');
document.write('a.slide:hover{text-decoration:none;color:#888;font:9px sans-serif;border:1px solid #660099;line-height:15px;}');

document.write('.slideover{border:#fff 1px solid; padding:1px; display:block; width:15px; height:15px; text-align:center;}');
document.write('a.slideover{text-decoration:none;color:#FFF;font:9px sans-serif;background-color:#333; display:bolck; float:left;font-weight:bold;line-height:20px;}');
document.write('a.slideover:{text-decoration:none;color:#fff;font:9px sans-serif;border:1px solid #660099;line-height:20px;}');
document.write('</style>');
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
document.write('<div><a id="slideurl"><img id="slidepic" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /></a></div>');
document.write('<div style="width:100%;text-align:left;top:-25px;left:835px; display:none; position:relative;height:20px;border:0px;">');
for(var i=1;i<counts+1;i++){document.write('<a href="javascript:changeimg('+i+');" id="slide'+i+'" class="slide" style="margin-left:5px;" target="_self">'+i+'</a>');}
document.write('</div></div>');
change_img();
...全文
98 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cloudgamer 2010-01-28
  • 打赏
  • 举报
回复
donet_expert 2010-01-27
  • 打赏
  • 举报
回复
应该是用
clearTimeout ( timeoutId );
来实现吧
ChrisXChen 2010-01-27
  • 打赏
  • 举报
回复
var widths=1003;    /*显示高度*/                  
var heights=250; /*显示宽度*/
var counts=3;
img1=new Image ();img1.src='/images/banner01.jpg';
img2=new Image ();img2.src='/images/banner03.jpg';
img3=new Image ();img3.src='/images/banner02.jpg';


url1=new Image ();url1.src='index.asp';
url2=new Image ();url2.src='index.asp';
url3=new Image ();url3.src='index.asp';

//
var nn=1;
var key=0;
function change_img(){
if(key==0){
key=1;
}else if(document.all){
document.getElementById("slidepic").filters[0].Apply();
document.getElementById("slidepic").filters[0].Play(duration=2);
}
eval('document.getElementById("slidepic").src=img'+nn+'.src');
eval('document.getElementById("slideurl").href=url'+nn+'.src');
for (var i=1;i <=counts;i++){
document.getElementById("slide"+i).className='slide';
}
document.getElementById("slide"+nn).className='slideover';
nn++;
if(nn>counts){nn=1;}
tt=setTimeout('change_img()',8000);
}

//
function changeimg(n){nn=n;window.clearInterval(tt);change_img();}
document.write(' <style type="text/css">');
document.write('.slide{border:#fff 1px solid; padding:1px; display:block; width:15px; height:15px; text-align:center;}');
document.write('a.slide{text-decoration:none;color:#888;font:9px sans-serif;background-color:#FC0; display:bolck; float:left;line-height:15px;}');
document.write('a.slide:hover{text-decoration:none;color:#888;font:9px sans-serif;border:1px solid #660099;line-height:15px;}');

document.write('.slideover{border:#fff 1px solid; padding:1px; display:block; width:15px; height:15px; text-align:center;}');
document.write('a.slideover{text-decoration:none;color:#FFF;font:9px sans-serif;background-color:#333; display:bolck; float:left;font-weight:bold;line-height:20px;}');
document.write('a.slideover:{text-decoration:none;color:#fff;font:9px sans-serif;border:1px solid #660099;line-height:20px;}');
document.write(' </style>');
document.write(' <div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
document.write(' <div> <a id="slideurl"> <img id="slidepic" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /> </a> </div>');
document.write(' <div style="width:100%;text-align:left;top:-25px;left:835px; display:none; position:relative;height:20px;border:0px;">');
for(var i=1;i <counts+1;i++){document.write(' <a href="javascript:changeimg('+i+');" id="slide'+i+'" class="slide" style="margin-left:5px;" target="_self">'+i+' </a>');}
document.write(' </div> </div>');
change_img();
ChrisXChen 2010-01-27
  • 打赏
  • 举报
回复
就加个鼠标放上去就停止播放的效果啊
没人会吗????????



5555555555555555

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧