日期:2014-05-17  浏览次数:20421 次

关于setInterval停止后,再次执行问题
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<div class="xiangmu02" ><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#282828">
<tr>
<td width="0">
     <div id="ddd" style="display:none;">
          <a href="#"><img src='images/06.jpg' border="0"></a>
          <a href="#"><img src='images/07.jpg' border="0"></a>
          <a href="#"><img src='images/08.jpg' border="0"></a>
          <a href="#"><img src='images/09.jpg' border="0"></a>
          <a href="#"><img src='images/10.jpg' border="0"></a>
   </div>
    </td>
    </tr>
    <tr id="td1">
      <td height="88" align="right" width="190" bgcolor="#282828">
      <img id="img1" src="images/01a.jpg" onmouseover="showDaTu('images/06.jpg','#')"/></td>
      <td rowspan="5" valign="top"><a id="defaulta" target="_blank"><img src="images/06.jpg" id="defaultImg" border="0"></a></td>
    </tr>
    <tr>
     <td height="88" align="right"><img id="img2" src="images/02.jpg" onmouseover="showDaTu('images/07.jpg','#')" /></td>
    </tr>
    <tr>
     <td height="88" align="right"><img id="img3" src="images/03.jpg" onmouseover="showDaTu('images/08.jpg','#')" /></td>
    </tr>
    <tr>
     <td height="88" align="right"><img id="img4" src="images/04.jpg" onmouseover="showDaTu('images/09.jpg','#')" /></td>
    </tr>
    <tr>
     <td height="88" align="right"><img id="img5" src="images/05.jpg" onmouseover="showDaTu('images/10.jpg','#')" /></td>
    </tr>

</table>
<script type="text/javascript">
  var index=0;
  var count=document.getElementById("ddd").getElementsByTagName("img").length;
  if(count>0)
  {
  oTimer = setInterval(showDaTuAuto,3000);
  }
  function showDaTuAuto()
  {
  var defaultImg=document.getElementById("defaultImg");
  var defaulta=document.getElementById("defaulta");
  defaultImg.src=document.getElem