日期:2014-05-16  浏览次数:20371 次

实现连续字幕滚动

我调试了下 它提示 

Microsoft JScript 运行时错误: 缺少对象
没有可用于当前位置的源代码 这是什么原因


<head runat="server">
  <title>无标题页</title>

//实现 复制内容填充 页面初始化 字幕暂停和滚动 的js代码

  <script language="javascript" type="text/javascript">
  function newsScroll()
  {
  if(scrollimg.parentNode.scrollLeft!=(scrollimg.clientWidth/2))
  scrollimg.parentNode.scrollLeft++;
   
  else
  scrollimg.parentNode.scrollLeft=0;

   
  }

  var tm=null
  function window.onload(){
  simg1.innerHTML=simg.innerHTML

  tm=setInterval('newScroll()',20)

  }

  function stop(){
  clearInterval(tm)
  }
   
  function start()
  {
  tm=setInterval('newScroll()',20)
   
  }
   
   
  </script>
</head>
<body background="aa.jpg">


//一个表格 稍微嵌套了下 有可能有些错误 请改改

<form id="form1" runat="server">
  <table width="543" border="0" cellpadding="0" cellspacing="0" >
  <tr>
  <td valign="bottom">
  <div style="width:543px; height:21; overflow:hidden" onmouseOver="stop()" onmouseOut="start()">
  <table width="543" border="0" cellpadding="0" cellspacing="0" id="scrollimg" >
  <tr>
  <td id="simg">
  <table width="543" border="0" cellpadding="0" cellspacing="0" >
  <tr>
  <td nowrap="nowrap">
  <font color="#FF6C02">*</font><a href="#">1.巧学巧用dfsdgdsgdfgfgdfdsfgdsgdf</a>
  <font color="#FF6C02">*</font><a href="#">2.巧学巧用dfgfdsgsdfgdsfgdsfgdsf</a>
  <font color="#FF6C02">*</font><a href="#">3.巧学巧用dfgdsdsfgdsgd</a>
  </td>
  </tr>
  </table>
  </td>
  <td id="simg1"></td>
  </tr>
  </table>
  </div>
  </td>
  </tr>
  </table> 
</form>
   
</body>
</html>


------解决方案--------------------
HTML code

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="gb2312" />
        <title></title>
        <style>
            * {margin:0; padding:0;}
            body {
                font-family:arial;
                font-size:12px;
            }
            ul {list-style:none;}
            .a {
                margin:100px; padding:0 5px;
                width:100px; height:22px; line-height:22px;
                border:1px solid red;
                overflow:hidden;
            }
        </style>        
    </head>
    <body>
        <ul id="a" class="a">
            <li>&yen; 1-1</li>
            <li>&yen; 1-2</li>
            <l