我也想自己写一个关于图片的SQL标签
就是能够控制向左和向右滚动的无缝图片滚动效果要怎么写,请多多帮助。
这个是代码
<div>
<div onmousedown=goright() style="DISPLAY: inline; BACKGROUND: url(http://i3.sinaimg.cn/edu/deco/2007/0924/career/job_mj_069.gif) no-repeat 11px 0px; FLOAT: left; MARGIN: 25px 0px 0px; OVERFLOW: hidden; WIDTH: 19px; CURSOR: pointer; HEIGHT: 52px"></div>
<div id=demo style="FLOAT: left; OVERFLOW: hidden; WIDTH: 150px; HEIGHT: 100px">
<table cellPadding=0 align=left border=0 cellspace="0">
<tr>
<td id=demo1 vAlign=top><img src="{$GetInstallDir}admin/img/png-0015.png"><img src="{$GetInstallDir}admin/img/png-0018.png"><img src="{$GetInstallDir}admin/img/png-1056.png"><img src="{$GetInstallDir}admin/img/png-1058.png"><img src="{$GetInstallDir}admin/img/png-1059.png"><img src="{$GetInstallDir}admin/img/png-10885.png"></td>
<td id=demo2 vAlign=top><img src="{$GetInstallDir}admin/img/png-0015.png"><img src="{$GetInstallDir}admin/img/png-0018.png"><img src="{$GetInstallDir}admin/img/png-1056.png"><img src="{$GetInstallDir}admin/img/png-1058.png"><img src="{$GetInstallDir}admin/img/png-1059.png"><img src="{$GetInstallDir}admin/img/png-10885.png"></td>
</tr>
</table>
</div>
<div onmousedown=goleft() style="DISPLAY: inline; BACKGROUND: url(http://i3.sinaimg.cn/edu/deco/2007/0924/career/job_mj_069.gif) no-repeat -8px 0px; FLOAT: left; MARGIN: 25px 0px 0px; OVERFLOW: hidden; WIDTH: 20px; CURSOR: pointer; HEIGHT: 52px"></div></div>
<SCRIPT>
var speed=30
var MoveTimeObj;
var MyMar;
demo2.innerHTML=demo1.innerHTML
demo.scrollLeft=demo.scrollWidth
function Marqueeright()
{
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else{
demo.scrollLeft--
}
}
function Marqueeleft(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
function MoveRight()
{
MyMar=setInterval(Marqueeright,30)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marqueeright,30)}
}
function MoveLeft()
{
MyMar=setInterval(Marqueeleft,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marqueeleft,speed)}
}
function goright()
{
clearInterval(MyMar);
MoveRight();
}
function goleft()
{
clearInterval(MyMar);
MoveLeft();
}
</SCRIPT>