当前位置: 代码迷 >> JavaScript >> JS滚动奇效让IE死了
  详细解决方案

JS滚动奇效让IE死了

热度:351   发布时间:2012-09-21 15:47:26.0
JS滚动特效让IE死了。
这是一段JS滚动新闻的代码。可是我运行后,IE就动不啦。帮我看看,是什么问题。
HTML code
<!--#include file="Connections/conn.asp" -->
<%
Dim gg
Dim gg_numRows

Set gg = Server.CreateObject("ADODB.Recordset")
gg.ActiveConnection = MM_conn_STRING
gg.Source = "SELECT *  FROM dbo.tz  ORDER BY n DESC,id desc"
gg.CursorType = 0
gg.CursorLocation = 2
gg.LockType = 1
gg.Open()

gg_numRows = 0
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = 5
Repeat2__index = 0
gg_numRows = gg_numRows + Repeat2__numRows
%>

<%
Dim rs
Dim rs_numRows

Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_conn_STRING
rs.Source = "SELECT * FROM dbo.d_time ORDER BY 报名开始时间 ASC"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

rs_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 5
Repeat1__index = 0
rs_numRows = rs_numRows + Repeat1__numRows
%>
<table width="959" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td nowrap><table id="__01" width="441" height="204" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="27" colspan="3" valign="top"><img src="im_tz/后台主界面副本_tz_01.jpg" width="441" height="27" alt=""></td>
      </tr>
      <tr>
        <td rowspan="2" valign="top"><img src="im_tz/后台主界面副本_tz_02.jpg" width="4" height="167" alt=""></td>
        <td height="162"><div id='marquee3' ></div></td>
        <td rowspan="2" valign="top"><img src="im_tz/后台主界面副本_tz_04.jpg" width="8" height="167" alt=""></td>
      </tr>
      <tr>
        <td valign="top"><img src="im_tz/后台主界面副本_tz_05.jpg" width="429" height="5" alt=""></td>
      </tr>
    </table></td>
    <td valign="top"><table id="__01" width="518" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="53" colspan="9" valign="top"><img src="im_sj/后台主界面副本_sj_01.jpg" width="518" height="53" alt="" /></td>
      </tr>
      <% 
While ((Repeat1__numRows <> 0) AND (NOT rs.EOF)) 
%>
        <tr>
            <td height="27" nowrap="nowrap"><div align="center"><img src="im_sj/后台主界面副本_sj_02.jpg" width="4" height="27" alt="" /></div></td>
          <td width="163" height="27" nowrap="nowrap"><div align="center"><%=(rs.Fields.Item("项目名称").Value)%></div></td>
          <td height="27" nowrap="nowrap"><div align="center"><img src="im_sj/后台主界面副本_sj_04.jpg" width="3" height="27" alt="" /></div></td>
          <td width="116" height="27" nowrap="nowrap"><div align="center"><%=(rs.Fields.Item("报名开始时间").Value)%></div></td>
          <td height="27" nowrap="nowrap"><div align="center"><img src="im_sj/后台主界面副本_sj_06.jpg" width="3" height="27" alt="" /></div></td>
          <td width="113" height="27" nowrap="nowrap"><div align="center"><%=(rs.Fields.Item("报名截止时间").Value)%></div></td>
          <td height="27" nowrap="nowrap"><div align="center"><img src="im_sj/后台主界面副本_sj_08.jpg" width="3" height="27" alt="" /></div></td>
          <td width="108" height="27" nowrap="nowrap"><div align="center"><%=(rs.Fields.Item("考试时间").Value)%></div></td>
          <td height="27" nowrap="nowrap"><div align="center"><img src="im_sj/后台主界面副本_sj_10.jpg" width="5" height="27" alt="" /></div></td>
        </tr>
        <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rs.MoveNext()
Wend
%>

      <tr>
        <td height="6" colspan="9"><img src="im_sj/后台主界面副本_sj_12.jpg" width="518" height="6" alt="" /></td>
      </tr>
    </table></td>
  </tr>
</table>
<script language="JavaScript">
function BYMarquee(){
    this.Content = [];    //显示内容
    this.Speed = 20;    //上移速度
    this.Object = {};    //marquee容器对象
    this.Pause = true;    //是否停留
    this.Start = function(){
        var o = this.Object;
        var Pause = this.Pause;
        var Stop = false;
        var Stop2 = false;
        o.onmouseover = function(){
            Stop = Stop2 = true;
        }
        o.onmouseout = function(){
            Stop = Stop2 = false;
        }
        var BodyHtml = [];
        for(var i in this.Content){
            BodyHtml.push("<a href=\"" + this.Content[i].link + "\">" + this.Content[i].text + "</a>");
        }
        var Dv = document.createElement("div");
        Dv.innerHTML = BodyHtml.join("<br />");
        o.appendChild(Dv);
        var DvHeight = Dv.offsetHeight;
        while(Dv.offsetHeight / 2 < o.offsetHeight){
            Dv.innerHTML += "<br />" + Dv.innerHTML;
        }
        Dv.innerHTML += "<br />" + Dv.innerHTML;
        setInterval(function(){
            if(!Stop){
                o.scrollTop ++;
                if(o.scrollTop == o.scrollHeight - o.offsetHeight){
                    o.scrollTop = DvHeight - o.offsetHeight;
                }
                if(Pause){
                    if(o.scrollTop % o.offsetHeight == 0){
                        Stop = true;
                        setTimeout(function(){
                            Stop = Stop2;
                        }, 3000);
                    }
                }
            }
        }, this.Speed);
    }
}

//实例3
var marquee3 = new BYMarquee();
marquee3.Content = [
<% 
While ((Repeat2__numRows <> 0) AND (NOT gg.EOF)) 
%>
    {link : 'http://www.abc.com/my_tz_view.asp?id=<%=gg("id")%>', text : '<%=gg("n_title")%>'},
    
     <% 
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  gg.MoveNext()
Wend
%>
];
marquee3.Speed = 50;
marquee3.Pause = false;
marquee3.Object = document.getElementById('marquee3');
marquee3.Start();

//销毁
 marquee3 = null;
</script>


<%
rs.Close()
Set rs = Nothing
%>
<%
gg.Close()
Set gg = Nothing
%>
 
  相关解决方案