读书人

JavaScript有关问题高手一定帮小弟我看

发布时间: 2012-01-24 23:11:54 作者: rapoo

JavaScript问题高手一定帮我看看
<!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>
<script type= "text/javascript ">
<!--
var menu_width = 150;
var show_width = 20
var menu_top = 40;
var move_mode = "a ";

function init()
{
addMenuHeader();
addItem( "电科技大 ", "http://www.sohu.com ", "_blank ");
addItem( "清华大学 ", "http://www.sohu.com ", "_blank ");
addItem( "北京大学 ", "http://www.sohu.com ", "_blank ");
addItem( "上海交大 ", "http://www.sohu.com ", "_blank ");
addMenuFoot();
document.getElementById( 'float_menu ').style.left = menu_width;
document.getElementById( 'float_menu ').style.visibility = "visible ";
}

function addMenuHeader()
{
var content = " <div id = 'float_menu ' style = 'position.absolute; left:0px; top:0px; '+menu_top+ ' width: ' "+eval(menu_width+20+2)+ "; ' onmouseover = ' "+moveOut()+ "; ' onmouseout = ' "+moveBack()+ "; '> ";
content += " <table width = '100% ' cellpadding = '0 ' cellspacing = '1 ' bgcolor = '#555555 '> ";
content += " <tr height = '20 '> ";
content += " <td style= 'background:#eeffff; ' width = ' "+menu_width+ " '> ";
content += "菜单项 </td> ";
content += " <td style= 'background:#c0edcc; ' rowspan = '50 ' width = ' "+eval(show_width + 2)+ "; ' ";
content += "大 <br> 学 <br> 链 <br> 接 <br> ";
content += " </td> </tr> ";
alert(content);
document.write(content);
}

function addMenuFoot()
{
content = " </table> </div> ";
document.write(content);
}

function addItem(text,url,target)
{
if(!target || target == " ")
{
target = "_blank ";
}
content = " <tr height = '20px '> <td style= 'background:#eeeeff; '> ";
content += " <a href = ' "+url+ " ' target= ' "+target+ " '> " + text;
content += " </a> </td> </tr> ";
document.write(content);
}

function moveOut()
{
if(move_mode == "smooth ")
{
moveOutSmooth();
}


else
{
moveOutSkip();
}
}

function moveBack()
{
if(move_mode == "smooth ")
{
moveBackSmooth();
}
else
{
moveBackSkip();
}
}

function moveOutSmooth()
{
var now_pos = parseInt(document.getElementById( "float_menu ").style.left);
if(window.movingBack)
{
clearTimeout(moving);
}
if(now_pos < 0)
{
var dx = 0 - now_pos;
if(dx > 30)
{
document.getElementById( "float_menu ").style.left = now_pos + 5;
}
else if(dx > 10)
{
document.getElementById( "float_menu ").style.left = now_pos + 2;
}
else
{
document.getElementById( "float_menu ").style.left = now_pos + 1;
}
movingOut = setTimeout( "moveOutSmooth() ",5);
}
else
{
clearTimeout(window.movingOut);
}
}

function moveOutSkip()
{
if(document.getElementById( "float_menu ").style.pixeLeft < 0)
{
document.getElementById( "float_menu ").style.pixeLeft = 0;
}
}

function moveBackSmooth()
{
if(window.movingOut)
{
clearTimeout(movingOut);
}
if(document.getElementById( "float_menu ").style.pixeLeft > eval(0 - menu_width))
{
var dx = document.getElementById( "float_menu ").style.pixeLeft - eval(0 - menu_width);
if(dx > 30)
{
document.getElementById( "float_menu ").style.pixeLeft -= 5;
}
else if(dx > 10)
{
document.getElementById( "float_menu ").style.pixeLeft -= 2;
}
else
{
document.getElementById( "float_menu ").style.pixeLeft -= 1;
}
movingOut = setTimeout( "moveBackSmooth() ",5);
}
else
{
clearTimeout(window.movingBack);
}
}

function moveBackSkip()
{
if(document.getElementById( "float_menu ").style.pixeLeft > eval(0 - menu_width))
{
document.getElementById( "float_menu ").style.pixeLeft = eval(0 - menu_width);
}
}
//-->
</script>
</head>

<body>
<script type= "text/javascript ">
<!--
init();
//-->
</script>
</body>
</html>


addMenuHeader() 调用 moveOut()/moveBack() 调用到这2个函数就无法显示出来了

各位大侠帮帮我啊

谢谢 只有30分了全部给出

[解决办法]
没有 float_menu 这个对象。
[解决办法]
如果是js的错误在IE的左下角会出现错误提示的,然后双击之查看详细信息,他会告诉你那一行有问题的。
再仔细调试吧。

读书人网 >Java Web开发

热点推荐