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

层的移动问题
以下是用层的left属性来实现一个 "滑动菜单 ",但是有问题,打开了没反应,请问是为什么啊,大家看盾.
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
<style   type= "text/css ">
<!--
#Layer1   {
position:absolute;
width:500px;
height:200px;
z-index:1;
}
-->
</style>
<script   language= "javascript ">
function   menuOut()
{clearTimeout(menuOut_id)
  if(menu_left <=500)
  menu_left+=20;
  menuOut_id=setTimeout( "menuOut() ",1);

}
function   menuIn()
{
clearTimeout(menuOut_id)
  if(menu_left <=-400)
  menu_left-=20;
  menuIn_id=setTimeout( "menuIn() ",1);
}
function   init()
{
menu   =   Layer1.style;
menu_left   =   menu.pixelLeft;
menu_top   =   menu.pixeltop;
menu_heigth   =   Layer1.offsetHeight;
menu_width   =   Layer1.offsetWidth;
menu_left=-400;
Layer1.style.visibility   =   "visible ";
menu.onmouseover   =   menuOut;
menu.onmouseout   =   menuIn;
}

</script>
</head>

<body   onload= "init() ">
<div   id= "Layer1 ">
    <table   width= "500 "   height= "200 "   border= "1 ">
        <tr>
            <td   width= "90% "> &nbsp; </td>
            <td   width= "10% "   bgcolor= "#00FF00 "> &nbsp; </td>
        </tr>
    </table>
</div>
</body>
</html>


------解决方案--------------------
你的menu对象哪来的?