menu1.style.left再加上(window.screen.width-页面的宽度)/2即可
解决方案 »
- 根据网页的名字显示不同的图片要怎么写?
- 请帮帮小妹!js获得select选中的值的问题!
- servlet 填充javaBean
- 请帮忙做个自动输入的sample,谢谢
- jquery的聚焦问题
- 请问怎样用javascript把页面的<HTML>...</html>全部alert出来啊?
- 框架页面的跳转!
- 'JScript.encode' 怎么解?
- 菜鸟的问题?????????????????????
- 百度地图api驾车路线经过多个地点,将地点和顺序代入怎么获取距离和时间
- 如何在一个PHP里执行一条或者几条语句,让另一个php刷新???
- 菜鸟:var NodeX = eval(ParentNode.id + '_0');什么意思呀?在线,马上结贴!
function in1(id){
menu1.style.visibility="visible";
menu1.style.left=getE(bygl)
menu1.style.top=getEh(bygl)+20
}
function out1(id){
menu1.style.visibility="hidden";
}
function getE(o){
a=0
while(o.tagName!="BODY")
{
a+=o.offsetLeft
o=o.parentElement
}
return a
}
function getEh(o){
a=0
while(o.tagName!="BODY")
{
a+=o.offsetTop
o=o.parentElement
}
return a
}
</script>
<body>
<div id=menu1 style="z-index: 4; visibility: hidden; width: 143; position: absolute; height: 84" border="1">gggggggggggggg</div>
<table border="0" width="662" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#5C8E4E" height="8" width="58"><img border="0" src="img/wel_2_1.gif" width="58" height="22"></td>
<TD id=menubar onmouseover="in1(this.childNodes(0).id)" onmouseout=out1(this.childNodes(0).id) align=middle bgcolor="#5C8E4E" width="54" height="8">
<div align="left" id=bygl><FONT color=#ffffff>兵员管理<br></FONT></div>
</td></tr></table>
function getL(e){
var l=e.offsetLeft;
while(e=e.offsetParent){
l+=e.offsetLeft;
}
return l
}
function getT(e){
var t=e.offsetTop;
while(e=e.offsetParent){
t+=e.offsetTop;
}
return t
}上:getT(obj),左:getL(obj)