使用層做的下拉式功能表適應任何解析度!

來源:互聯網
上載者:User
用層做下拉式功能表先天不足,因為隨著解析度的改變而位置會變化,現在我們就來突破這點!
1.<a href="#" onMouseOver="MM_showHideLayers('Layer1','','show')" onMouseOut="MM_showHideLayers('Layer1','','hide')">關於我們</a> 
連結裡面的特效!
2.當然還有JS特效!

<script type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>
3.下拉式功能表層的設計:
 <DIV id=Layer1 onMouseOver="MM_showHideLayers('Layer1','','show')" onMouseOut="MM_showHideLayers('Layer1','','hide')"
            style="Z-INDEX: 1; LEFT: 71px; WIDTH: 90px; POSITION: absolute; TOP: 14px; HEIGHT: 80px; visibility: hidden;"
           >
<TABLE cellSpacing=0 cellPadding=0 width="95%" border=0>
              <TBODY>
              <TR>
                <TD height=12></TD></TR></TBODY></TABLE>
            <TABLE cellSpacing=1 cellPadding=1 width="86" bgColor=#e4e4e4
            border=0>
              <TBODY>
              <TR>
                <TD height="20" align=center bgColor=#034949 class=titel_b><A
                  class=titel_b
                  href="Aboutus.asp">公司簡介</A>                </TD>
              </TR>
              <TR>
                <TD height="20" align=center bgColor=#034949><A class=titel_b
                  href="#"
                  target=_blank>企業理念 </A></TD>
              </TR>
              <TR>
        <TD height="20" align=center bgColor=#034949><SPAN class=titel_b><A
                  class=titel_b
                  href="#"
                  target=_blank>企業文化</A></SPAN></TD>
              </TR></TBODY></TABLE></DIV>
4.做一個表格專門放下拉式功能表的(重點),這個表格就放到下拉式功能表的表格的上面建的一個表格裡面即可定位。樣式表用class=ceng
<TABLE class=ceng cellSpacing=0 cellPadding=0 width="95%" border=0>
        <TBODY>
        <TR>
          <TD>
   放所有下拉式功能表的層的地方  </TD>
      </TR></TBODY></TABLE>
5.main.css
.ceng {
 POSITION: relative
}
好的,測試吧,沒問題了!

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.