qq页面上的 javascript怎么写的
发布网友
发布时间:2022-04-24 11:03
我来回答
共3个回答
热心网友
时间:2022-04-24 12:32
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
</head>
<body>
<div id="main" style=" width:600px; height:200px; overflow:hidden; ">
<table cellpadding="0" cellspacing="0"><tr><td id="pic" >
<table cellpadding="0" cellspacing="0"><tr><td>
<div id="t1" style=" text-align:center; position:absolute; z-index:999; background-color:Purple; height:20px; width:20px; top: 182px; left: 447px;" onmouseover="tag_moveover(0)" onmouseout="tag_moveout(0)">1</div>
<div id="t2" style=" text-align:center; position:absolute; z-index:999; background-color:Purple; height:20px; width:20px; top: 182px; left: 477px;" onmouseover="tag_moveover(1)" onmouseout="tag_moveout(1)">2</div>
<div id="t3" style=" text-align:center; position:absolute; z-index:999; background-color:Purple; height:20px; width:20px; top: 182px; left: 507px;" onmouseover="tag_moveover(2)" onmouseout="tag_moveout(2)">3</div>
<div id="t4" style=" text-align:center; position:absolute; z-index:999; background-color:Purple; height:20px; width:20px; top: 182px; left: 537px;" onmouseover="tag_moveover(3)" onmouseout="tag_moveout(3)">4</div>
<table width="600" cellpadding="0" cellspacing="0"><tr><td style=" background-color:Black; height:200px;" >
</td></tr></table></td>
<td> <table width="600"; cellpadding="0" cellspacing="0"><tr><td style="background-color:Blue; height:200px; "></td></tr></table></td>
<td><table width="600" cellpadding="0" cellspacing="0"><tr><td style="background-color:Red; height:200px; "></td></tr></table></td>
<td><table width="600" cellpadding="0" cellspacing="0"><tr><td style="background-color:Green; height:200px; "></td></tr></table>
</td></tr></table>
</td></tr></table>
</div>
</body><script type="text/javascript">
var main=document.getElementById("main");
var pic=document.getElementById("pic");
var i=0;
var j=0;
var indefinetab;
var tab;
var w=0;
var timeout;
function change(){
if(i>3)i=0;
i++;
tab=setInterval(move,10);
}
function move(){
i>3?moveleft():moveright();
}
function tag_moveover(p){
clearInterval(indefinetab);
clearInterval(timeout);
j=p;
main.scrollLeft>=600*j?w=-50:w=50;
indefinetab=setInterval(tag_indefinemove,10);
}
function tag_indefinemove(){
main.scrollLeft+=w;
if(main.scrollLeft==600*j){ clearInterval(indefinetab);}
}
function tag_moveout(l){
i=l;
timeout= setInterval(change,5000);
}
function moveleft(){
main.scrollLeft-=50;
if(main.scrollLeft==0){clearInterval(tab);}
}
function moveright(){
main.scrollLeft+=50;
if((main.scrollLeft%600)==0){ clearInterval(tab);}
}
timeout= setInterval(change,5000);
</script>
</html>
初学菜鸟 编的不好请指教
热心网友
时间:2022-04-24 13:50
一个setTimeout函数的渐变!!
想要完整代码的话,Hi我!!
热心网友
时间:2022-04-24 15:25
你看一下它的源码就好了啊。