帮你写了一个简单的例子,自己参考一下,应该可以做到的了.
帮你写了一个简单的例子,自己参考一下
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
function moves()
{
if(document.getElementById("mq").direction=="left")
{
document.getElementById("mq").direction="right";
}
else
{
document.getElementById("mq").direction="left";
}
}
</script>
<body>
<input type="button" name="Submit" value="left" onClick="moves()">
<marquee dir="ltr" direction="left" id="mq">fsdfsf</marquee>
<input type="button" name="Submit2" value="right" onClick="moves()">
</body>
</html>

解决方案 »

  1.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style>
    .clickspan {
        width:60px;
        cursor:pointer;    
        background:#ccc;
        height:115px;
        overflow:hidden
    }
    .rollingText{ 
    white-space:nowrap;
    width:600px;
    height:115px;
    padding:3px 0 7px 0;
    border-right:1px solid #CDC5B8;
    overflow:hidden;
    border:1px #ccc solid;
    }
    .rollingText ul, .rollingText ul li {
        float:left;
        height:115px;
        overflow:hidden;
    }
    .rollingText ul {
        width:924px;
        border-left:1px solid #d2c5a5;
    }
    .rollingText ul li {
        width:208px;
    }
    .rollingText ul li span {
        display:block;
        height:26px;
        line-height:26px;
        padding-left:26px;
        border:1px solid #ccc;
    }
    .rollingText ul li p {
        padding:14px 15px 18px 26px;
        line-height:20px;
        border:1px #ccc solid;
    }
    </style>
    </head>
    <body>
    <span class=clickspan onmousedown="m(0)" ><--向左</span>
    <span class="rollingText" id="a">
    <ul>
        <li><span>2000年6月6日</span>
          <p>公司正式成立</p>
        </li>
        <li><span>2000年9月</span>
          <p>受到社会的广泛好评;</p>
        </li>
        <li><span>2001年7月</span>
          <p>正式发行;</p>
        </li>
         <li><span>2000年6月6日</span>
          <p>公司正式成立</p>
        </li>
        <li><span>2000年9月</span>
          <p>受到社会的广泛好评;</p>
        </li>
        <li><span>2001年7月</span>
          <p>正式发行;</p>
        </li>
    </ul>
    </span>
    <span class=clickspan onmousedown="m(1)" >向右--></span>
    <script >
    var tt=null;
    function m(i){
    if(i==0){document.getElementById("a").scrollLeft++;tt=setTimeout( "m("+i+")");}
    if(i==1){document.getElementById("a").scrollLeft--;tt=setTimeout( "m("+i+")");}
    }
    document.onmouseup=function(){clearTimeout(tt)}
    </script>
    </body>
    </html>注意此代码不能添加<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    否则看不到效果