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

小弟刚接触js,关于计时器的问题,现上代码,求解决。
<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
a:link {
color: #42413C;
text-decoration:none; /* 除非将链接设置成极为独特的外观样式,否则最好提供下划线,以便可从视觉上快速识别 */
}
a:visited {
color: #6E6C64;
text-decoration:none;
}
a:hover, a:active, a:focus { /* 此组选择器将为键盘导航者提供与鼠标使用者相同的悬停体验。 */
text-decoration: none;
}
/* ~~ 此固定宽度容器包含其它 div ~~ */
.container {
width: 960px;
background: #FFF;
margin: 0 auto; /* 侧边的自动值与宽度结合使用,可以将布局居中对齐 */
}
/* ~~ 标题未指定宽度。它将扩展到布局的完整宽度。标题包含一个图像占位符,该占位符应替换为您自己的链接徽标 ~~ */
.header {
background: #ADB96E;
}
/* ~~ 这是布局信息。 ~~ 

1) 填充只会放置于 div 的顶部和/或底部。此 div 中的元素侧边会有填充。这样,您可以避免使用任何“方框模型数学”。请注意,如果向 div 自身添加任何侧边填充或边框,这些侧边填充或边框将与您定义的宽度相加,得出 *总计* 宽度。您也可以选择删除 div 中的元素的填充,并在该元素中另外放置一个没有任何宽度但具有设计所需填充的 div。

*/

.content {
padding: 10px 0;
}
/* ~~ 脚注 ~~ */
.footer {
padding: 10px 0;
background: #CCC49F;
}
.sideFence {
z-index:1;
opacity:0.7;
position:fixed;
}
-->
</style>
<script language="javascript" type="text/javascript">
var timer_one;
var timer_zero;
function mouseover()
 {
timer_zero = setInterval('sidePop()',100);
 
}
function mouseout()
  {
timer_one = setInterval('sideHide()',100);
 
}
 

function sidePop(){
var w = parseInt(document.getElementById("sideFence").style.width);
  if(w<250)
{
w=w+25;
var n = w+"px";
document.getElementById("sideFence").style.width=n;
}
else{
clearInterval(timer_zero);
}
}

function sideHide(){
var w = parseInt(document.getElementById("sideFence").style.width);
if(w>=25)
{
w=w-25;
var n = w+"px";
document.getElementById("sideFence").style.width=n;
}
else{
clearInterval(timer_one);
}
}
</script>

</head>

<body>
<div class="sideFence" id="sideFence" onmouseout="mouseout()" onmouseover="mouseover()" style="width:25px; height:auto; top:250px; right:0; overflow:hidden;background-color: #FFFFFF; display:block;" >
  <table cellpadding="0" cellspacing="0">
  <tr >
  <td bgcolor="#FFFFFF"><a href="javaScript:void(0)"><img style=" opacity:0.6"src="picture/side.jpg" ></a></td>
  <td align="center" bgcolor="#CCCCCC" >
  <div style="height:25px;overflow:hidden; width:250px;"><span style="font-family:Elephant">英雄帖</span></div>
  <div style="height:244px; width:100%; overflow:hidden; background-color:#FFFFFF " >
  <table>
  <tr/>
  <tr>
  <td><font color="#000000">01 <a href="#">爱丽丝伪娘团全国招募中!</a></font></td>
  </tr>
  <tr>
  <td><font color="#000000">02 <a href="#">爱丽丝伪娘团