| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 614 人关注过本帖
标题:请大家帮忙让上面的导航栏只显示在一行
只看楼主 加入收藏
yangjf0021
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-3-11
收藏
 问题点数:0 回复次数:1 
请大家帮忙让上面的导航栏只显示在一行
图片附件: 游客没有浏览图片的权限,请 登录注册

<head>
<title></title>
<script type=text/javascript>
/**
*菜单的构造,需要绑定到onload
*/
startList = function() {
if (document.all&&document.getElementById) {
dropmenuRoot = document.getElementById("dropmenu");
for (i=0; i<dropmenuRoot.childNodes.length; i++) {
node = dropmenuRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
//开始灌水
for(j=0;j<this.childNodes.length;j++){
if (this.childNodes[j].nodeName=="UL"){
if (this.childNodes[j].childNodes[0].nodeName=="LI"){
if (this.offsetLeft+this.childNodes[j].childNodes.length*this.childNodes[j].childNodes[0].offsetWidth-dropmenuRoot.offsetLeft>dropmenuRoot.offsetWidth){
var len=this.childNodes[j].childNodes.length*this.childNodes[j].childNodes[0].offsetWidth; //菜单的长度
(len>dropmenuRoot.offsetWidth) ? this.childNodes[j].style.width=776+"px" : this.childNodes[j].style.width=len+"px"; //给ul设置宽度 如果子菜单比较多,大于容器的宽度,那么ul的宽度就是容器的宽度
len =this.offsetLeft+len-dropmenuRoot.offsetLeft-dropmenuRoot.offsetWidth;
(len>this.offsetLeft-dropmenuRoot.offsetLeft) ? this.childNodes[j].style.marginLeft=-(this.offsetLeft-dropmenuRoot.offsetLeft) : this.childNodes[j].style.marginLeft=-len+"px";
}
}
}
}
}
//灌水完毕
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>
</head>
<style type="text/css">
body { font: normal 11px verdana; position:absolute }
ul { margin: 0; padding: 0; }
li { list-style-position: outside; list-style: none;}
a { text-decoration: none; color: #666;}
ul#dropmenu,ul#dropmenu ul{
margin: 0 auto;
text-align: left;
padding: 0;
list-style: none;
z-index: 99;
}
ul#dropmenu {
width: 774px;
display: block;
height: 24px;
clear: both;
border: 1px solid #ccc;
text-align: center;
background: #fff;
}
ul#dropmenu li {
position: relative;
z-index: 999;
float: left;
}
ul#dropmenu ul li{
float: left;
display: block;
}
ul#dropmenu ul {
/*width: 50px;
w\idth: 50px;*/
height: auto;
position: absolute;
text-align: left;
left: 0px;
display: none;
border: solid 1px #ccc;
}
/*当鼠标在子菜单和父菜单上时,父菜单的样式*/
ul#dropmenu li.over a,ul#dropmenu li:hover a{
border-color: #ccc;
background: #c00;
color: #fff;
}
/*将子菜单的样式清除*/
ul#dropmenu li.over ul a,ul#dropmenu li:hover ul a{
font-weight: normal;
color: #666;
background: #fff;;
}
/*子菜单的hover样式*/
ul#dropmenu li.over ul a:hover,ul#dropmenu li:hover ul a:hover{
font-weight: normal;
color: #cc0000;
font-weight: bold;
background: #f6f6f6;
}
/* Styles for Menu Items */
ul#dropmenu a {
display: block;
padding: 0 0 0 10px;
width: 106px;
w\idth: 96px;
color: #666;
line-height: 24px;
}
ul#dropmenu ul li{
width: 110px;
border: 0;
}
/* End */
ul#dropmenu ul a {
FILTER: progid:DXImageTransform.Microsoft.Alpha(opacity=70); /* 透明 */
padding: 2px 0px 2px 10px;
border: 0;
width: 120px;
w\idth: 110px;/* Sub Menu Styles */
}
ul#dropmenu li:hover ul,ul#dropmenu li.over ul {
display: block; /* The magic */
}
</style>

<LINK media=screen href="file:///C:/Documents%20and%20Settings/Administrator/桌面/images/styles.css" rel=stylesheet>
<div align="center">
<TABLE border=0 cellPadding=0 cellSpacing=0 bgColor=white id="table1">
  <TBODY>
    <TR>
      <TD bgColor=#000000><IMG height=1
      src="images/transparent.gif"
      width=1 border=0></TD>
    </TR>
    <TR>
      <TD
    background="images/banner_background.gif">
        <TABLE width=761 height="76" border=0 cellPadding=0 cellSpacing=0 id="table2">
          <TBODY>
            <TR>
              <TD width="761" height="76">
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.,0,29,0" width="760" height="76">
                  <param name="movie" value="index3.swf">
                  <param name="quality" value="high">
                  <embed src="index3.swf" quality="high" pluginspage="http://www. type="application/x-shockwave-flash" width="760" height="76"></embed></object></TD>
            </TR>
          </TBODY>
        </TABLE></TD>
    </TR>
    <TR>
      <TD><IMG height=5 alt=""
      src="images/tbar2.gif"
      width=760 border=0></TD>
    </TR>
    <TR>
      <TD width="10%">
        
              

<div id="nav">
<ul id="dropmenu">
<li><strong><a href="index.asp"><font color="#990000">首页</font></a></strong></li>
<li><strong><a href="qywh.asp"><font color="#990000">企业文化</font></a></strong></li>
<li><strong><a href="content.asp"><font color="#990000">客户服务</font></a></strong></li>
<li><strong><a href="product.asp"><font color="#990000">工程展示</font></a></strong>
<ul>
<li><a href="#">History</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Team</a></li>
</ul>
</li>
<li><strong><a href="content0.asp"><font color="#990000">国际贸易</font></a></strong></li>
<li><strong><a href="content1.asp"><font color="#990000">招标公布</font></a></strong></li>
<li><strong><a href="content2.asp"><font color="#990000">项目开发</font></a></strong></li>
<li><strong><a href="content3.asp"><font color="#990000">分支机构</font></a></strong></li>
<li><strong><a href="bbs/default.asp"  target=_blank><font color="#990000">中经互动</font></a></strong></li>
<li><strong><a href="contactus.asp"><font color="#990000">联系我们</font></a></strong></li>
</ul>
</div>

</TD>
    </TR>
  </TBODY>
</TABLE>
</div>
<script language="javascript">
function click() {
if (event.button==2) {
alert('不许你点右键!')
}
}
document.onmousedown=click
</script>
搜索更多相关主题的帖子: 导航 
2008-03-11 10:10
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
ul#dropmenu a {
display: block;
padding: 0 0 0 10px;
width: 86px;
w\idth: 76px;
color: #666;
line-height: 24px;
}
2008-03-11 10:43
快速回复:请大家帮忙让上面的导航栏只显示在一行
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024001 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved