二级菜单Li宽度为何无法改变(急!在线等待)

xiongweiyu88 2009-10-06 03:13:34
<!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>
<style>
ul {
padding: 0px;
list-style-type: none;
z-index:102;
margin:0px;

}
ul li{
position: relative;
width:85px !important;
width: 87px;
height: 25px;
font-size: 14px;
line-height: 25px;
text-align: center;
float: left;
VERTICAL-ALIGN: middle;
margin-right:0px;
border:1px solid #000000;
background-color:#fff;
color:#fff;
z-index:100;
list-style-type:none;

}
ul ul a:hover{ display:block; color:#f00; position:relative; z-index:110; width:12em; }
ul ul a{display:block; z-index:110; width:12em;}

li ul{
position:absolute;
display: none;
list-style:none;
left:-30px;

}

ul li a{
text-decoration:none;
display: block;
}
li:hover ul{
display:block;
}
li.over ul{
display:block
}
BODY {
MARGIN: 0px;
background-position-x: 50%;
background-position-y: 50%;
font-size: 12px;
}
</style>
<script language="javascript">
menuList = function() {
if (document.getElementById) {
navRoot = document.getElementById("object1");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(/ over/g, "");
}
}
}
}
}
window.onload=menuList;
</script>
</head>

<body>
<div align="center">
<TABLE width=870 border=0 align="center" cellPadding=0 cellSpacing=0 class=Outside >
<TBODY>
<div style=" width:870px; background-color:#FFFFFF; text-align:center">
<ul id="menu">
<li><a href="index.php">#111111111</a>
<ul>
</ul>
</li>
<li><A href="news.php" >1111111111</a>
<ul style="list-style-type:none;margin:0px;">
<li class="childclass"><a href="news.php?nid=1">111111111</a></li>
<li class="childclass"><a href="news.php?nid=4" >11111</a></li>
<li class="childclass"><a href="news.php?nid=7" >11111111</a></li>
</ul>
</li>
<li><A href="product.php" >11111111111</a>
<ul>
<li class="childclass"><a href="product.php?pid=28">1111111111</a></li>
<li class="childclass"><a href="product.php?pid=27">11111111</a></li>
</ul>
</li>
<li><A href="case.php" >111111111</a>
<ul>
<li class="childclass"><a href="case.php?cid=8" >11111111</a></li>
<li class="childclass"><a href="case.php?cid=5" >1111111111</a></li>
<li class="childclass"><a href="case.php?cid=7" >111111111</a></li>
<li class="childclass"><a href="case.php?cid=9">11111111</a></li>
<li class="childclass"><a href="case.php?cid=6" >111111111</a></li>

</ul>
</li>
<li><A href="article.php" >11111111</a>
<ul>

</ul>
</li>
<li><A href="contact.php" >11111111</a>
<ul>
</ul>
</li>
<li><A href="about.php" >1111111111</a>
<ul>
<li class="childclass"><a href="about.php?aid=6" >111111111</a></li>
<li class="childclass"><a href="about.php?aid=7" >11111111</a></li>
<li class="childclass"><a href="about.php?aid=8" >11111111</a></li>
<li class="childclass"><a href="about.php?aid=16" >11111111</a></li>
<li class="childclass"><a href="about.php?aid=17" >1111111</a></li>
<li class="childclass"><a href="about.php?aid=18" >111111111</a></li>
<li class="childclass"><a href="about.php?aid=19" >111111111</a></li>
<li class="childclass"><a href="about.php?aid=20" >1111111111</a></li>
<li class="childclass"><a href="http://www.gnhongtudi.com/about.php?aid=21" >11111111</a></li>
</ul>
</li>
<li><A href="person.php" >111111111</a>
<ul>
</ul>
</li>
<li><A href="guest.php" >1111111111</a>
<ul>
<li class="childclass"><a href="guest.php?act=add" >11111111</a></li>
<li class="childclass"><a href="guest.php?act=manager" >1111111111</a></li>
</ul>
</li>
<li><A href="service.php">11111111</a>
<ul>
<li class="childclass"><a href="service.php?sid=1" >1111111111</a></li>
<li class="childclass"><a href="service.php?sid=6" >111111111</a></li>
<li class="childclass"><a href="http://www.gnhongtudi.com/down.php" >11111111</a></li>
</ul>
</li>
</ul>
</div>
</TBODY>
</TABLE>
</div>
</body>
</html>
...全文
227 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
MuBeiBei 2009-10-07
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 xiongweiyu88 的回复:]
其实这JS没用,是那!important造成的,我把!important去了就行,结贴
[/Quote]

解决了就好~·我以为是JS报错造成的~·学习了~·
xiongweiyu88 2009-10-07
  • 打赏
  • 举报
回复
其实这JS没用,是那!important造成的,我把!important去了就行,结贴
zlcqupt 2009-10-07
  • 打赏
  • 举报
回复
帮顶
MuBeiBei 2009-10-07
  • 打赏
  • 举报
回复

<script language="javascript">
menuList = function() {
if (document.getElementById) {
navRoot = document.getElementById("object1"); //你这块有问题~·object1是那个元素?
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(/ over/g, "");
}
}
}
}
}
window.onload=menuList;
</script>


你JS报错~·document.getElementById("object1");页面里根本就没有object1的ID~·
xiongweiyu88 2009-10-07
  • 打赏
  • 举报
回复
怎么设都不起作用
sforiz 2009-10-06
  • 打赏
  • 举报
回复
样式表中的宽度没起作用吗?

61,111

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧