Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu - submenu - next level down

Status
Not open for further replies.

LebronJames

Programmer
Apr 5, 2003
93
Here is the source code. I have a menu with a submenu but I want to add a menu or another level to the submenu like this:

Level1
----->Level2
----------> Level3

I want to add a level 3 as per outline. The root of the menu is in a table in the Menu.html and the submenu is in the Menu.xml..


Help is appreciated


Menu.html

<html>
<head>
<title></title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<meta name=&quot;description&quot; content=&quot;&quot;>
<meta name=&quot;keywords&quot; content=&quot;&quot;>

<link rel=&quot;stylesheet&quot; href=&quot;default.css&quot; type=&quot;text/css&quot; />


</head>
<body bgcolor=&quot;#ffffff&quot; topmargin=&quot;0&quot; leftmargin=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot;>

</SCRIPT>

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!--// Hide from old browsers

var ToolBar_Supported = ToolBar_Supported;
if (ToolBar_Supported != null && ToolBar_Supported == true)
{
TBDownLevelDiv.style.display ='none';
drawToolbar();
var fBrowserOK = true;
}

//-->
</script>
<!-- end quick search -->

<!-- left nav output -->

<!--start flyout table-->
<table class=&quot;flyoutMenu&quot; menudata=&quot;menu.xml&quot; width=&quot;180&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;border-right-width: 1px&quot;><tr><td>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot;>
<a href=&quot;/sql/default.asp&quot;>SQL Server Home</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot; handle=&quot;evaluation&quot;>
<a href=&quot;/sql/evaluation/default.asp&quot;>Evaluation</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot; handle=&quot;how_to_buy&quot;>
<a href=&quot;/sql/howtobuy/default.asp&quot;>How to Buy</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot; handle=&quot;technical_resources&quot;>
<a href=&quot;/sql/techinfo/default.asp&quot;>Technical Resources</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot; handle=&quot;using_sql_server&quot;>
<a href=&quot;/sql/using/default.asp&quot;>Using SQL Server</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot;>
<a href=&quot;/sql/downloads/default.asp&quot;>Downloads</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot;>
<a href=&quot;/sql/support/default.asp&quot;>Support</a>
</td></tr></table>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot;>
<a href=&quot;/sql/partners/default.asp&quot;>Partners</a>
</td></tr></table>

</td></tr></table>
<table class=&quot;flyoutMenu&quot; menudata=&quot;menu.xml&quot; width=&quot;180&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;border-right-width: 1px&quot;><tr><td>

<table width=&quot;176&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;><tr><td class=&quot;flyoutLink&quot; handle=&quot;microsoft_servers&quot;>
<a href=&quot;/servers/&quot;>Microsoft Servers</a>
</td></tr></table>

</body>
</html>



MENU.xml

<menu site=&quot;Servers&quot; subsite=&quot;Sql Banner&quot;>
<submenu handle=&quot;evaluation&quot;>
<item href=&quot;/sql/evaluation/default.asp&quot; label=&quot;Evaluation: Overview&quot; />
<item href=&quot;/sql/evaluation/overview/default.asp&quot; label=&quot;Product Overview&quot; />
<item href=&quot;/sql/evaluation/features/default.asp&quot; label=&quot;Features&quot; />
<item href=&quot;/sql/evaluation/2000/demo.asp&quot; label=&quot;Demo&quot; />
<item href=&quot;/sql/evaluation/trial/2000/default.asp&quot; label=&quot;Trial Software&quot; />
<item href=&quot;/sql/evaluation/sysreqs/2000/default.asp&quot; label=&quot;System Requirements&quot; />
<item href=&quot;/sql/evaluation/news/default.asp&quot; label=&quot;News &amp; Reviews&quot; />
<item href=&quot;/sql/evaluation/compare/default.asp&quot; label=&quot;Competitive Comparisons&quot; />
<item href=&quot;/sql/evaluation/casestudies/2000/default.asp&quot; label=&quot;Case Studies&quot; />
<item href=&quot;/sql/evaluation/70/default.asp&quot; label=&quot;Previous Versions&quot; />
<item href=&quot;/sql/evaluation/CE/default.asp&quot; label=&quot;SQL Server CE&quot; />
</submenu>
<submenu handle=&quot;how_to_buy&quot;>
<item href=&quot;/sql/howtobuy/default.asp&quot; label=&quot;How to Buy: Overview&quot; />
<item href=&quot;/sql/howtobuy/choosing/default.asp&quot; label=&quot;Choose Your Edition&quot; />
<item href=&quot;/sql/howtobuy/pricing/default.asp&quot; label=&quot;Pricing &amp; Licensing&quot; />
<item href=&quot;/sql/howtobuy/upgrading/default.asp&quot; label=&quot;Upgrading&quot; />
<item href=&quot;/sql/howtobuy/purchasing/default.asp&quot; label=&quot;Find Purchase Options&quot; />
</submenu>
<submenu handle=&quot;technical_resources&quot;>
<item href=&quot;/sql/techinfo/default.asp&quot; label=&quot;Technical Resources: Overview&quot; />
<item href=&quot;/sql/techinfo/planning/default.asp&quot; label=&quot;Planning&quot; />
<item href=&quot;/sql/techinfo/development/2000/default.asp&quot; label=&quot;Development&quot; />
<item href=&quot;/sql/techinfo/deployment/2000/default.asp&quot; label=&quot;Deployment&quot; />
<item href=&quot;/sql/techinfo/administration/2000/default.asp&quot; label=&quot;Administration&quot; />
<item href=&quot;/sql/techinfo/productdoc/2000/default.asp&quot; label=&quot;Product Documentation&quot; />
<item href=&quot;/sql/techinfo/BI/default.asp&quot; label=&quot;Business Intelligence&quot; />
</submenu>
<submenu handle=&quot;using_sql_server&quot;>
<item href=&quot;/sql/using/default.asp&quot; label=&quot;Using SQL Server: Overview&quot; />
<item href=&quot;/sql/using/tips/default.asp&quot; label=&quot;Tips &amp; Tricks&quot; />
<item href=&quot;/sql/using/training/default.asp&quot; label=&quot;Training &amp; Events&quot; />
<item href=&quot;/sql/using/books/beginners.asp&quot; label=&quot;Books&quot; />
</submenu>
<submenu handle=&quot;microsoft_servers&quot;>
<item href=&quot;/servers/evaluation/overview/default.asp&quot; label=&quot;Microsoft Servers: Overview&quot; />
<item href=&quot;/applicationcenter/default.asp&quot; label=&quot;Application Center&quot; />
<item href=&quot;/backofficeserver/&quot; label=&quot;BackOffice Server&quot; />
<item href=&quot;/biztalk/default.asp&quot; label=&quot;BizTalk Server&quot; />
<item href=&quot;/commerceserver/&quot; label=&quot;Commerce Server&quot; />
<item href=&quot;/cmserver/&quot; label=&quot;Content Management Server&quot; />
<item href=&quot;/exchange/&quot; label=&quot;Exchange Server&quot; />
<item href=&quot;/hiserver/&quot; label=&quot;Host Integration Server&quot; />
<item href=&quot;/isaserver/&quot; label=&quot;Internet Security and Acceleration Server&quot; />
<item href=&quot;/miserver/default.asp&quot; label=&quot;Mobile Information Server&quot; />
<item href=&quot;/proxy/&quot; label=&quot;Proxy Server&quot; />
<item href=&quot;/sharepoint/default.asp&quot; label=&quot;SharePoint Portal Server&quot; />
<item href=&quot;/siteserver/site/&quot; label=&quot;Site Server&quot; />
<item href=&quot;/siteserver/commerce/&quot; label=&quot;Site Server Commerce&quot; />
<item href=&quot;/sbserver/&quot; label=&quot;Small Business Server&quot; />
<item href=&quot;/sna/&quot; label=&quot;SNA Server&quot; />
<item href=&quot;/sql/&quot; label=&quot;SQL Server&quot; />
<item href=&quot;/smsmgmt/&quot; label=&quot;Systems Management Server&quot; />
<item href=&quot;/windows2000/server/&quot; label=&quot;Windows 2000 Server&quot; />
<item href=&quot;/windows2000/advancedserver/&quot; label=&quot;Windows 2000 Advanced Server&quot; />
<item href=&quot;/windows2000/datacenter/&quot; label=&quot;Windows 2000 Datacenter Server&quot; />
</submenu>
</menu>
 
I can give u a copy of the code that will do it for you, if you would like
 
here it is:

menu_sys.js:

Code:
var lastmenu=&quot;&quot;

function domenu(currMenu,new_offset,variant) {
         if (document.getElementById) {
            if (lastmenu!=&quot;&quot;) {
               if (new_offset>0) {
                  offset=new_offset
               }
               else {
                    offset=offset_orig
               }
               name_length=lastmenu.length
               name_length1=currMenu.length

               if (name_length>name_length1) {
                  menu_num1=(lastmenu.substring(name_length-3,name_length-2))
                  lvl1=parseInt(lastmenu.substring(name_length-2,name_length))
                  menu_num2=(currMenu.substring(name_length1-2,name_length1-1))
                  lvl=parseInt(currMenu.substring(name_length1-1,name_length1))
               }
               else if (name_length1>name_length) {
                    menu_num1=(lastmenu.substring(name_length-2,name_length-1))
                    lvl1=parseInt(lastmenu.substring(name_length-1,name_length))
                    menu_num2=(currMenu.substring(name_length1-3,name_length1-2))
                    lvl=parseInt(currMenu.substring(name_length1-2,name_length1))
               }
               else {
                    menu_num1=(lastmenu.substring(name_length-2,name_length-1))
                    lvl1=parseInt(lastmenu.substring(name_length-1,name_length))
                    menu_num2=(currMenu.substring(name_length1-2,name_length1-1))
                    lvl=parseInt(currMenu.substring(name_length1-1,name_length1))
               }

               if (menu_num1!=menu_num2 || lvl1>offset) {
                  document.getElementById(lastmenu).style.display=&quot;none&quot;
                  if (menu_num1!=menu_num2) {
                     for (i=0; i<=num_lvls; i++) {
                         tst=&quot;menu_&quot;+menu_num1+i
                         if (document.getElementById(tst)!=null) {
                            tst=document.getElementById(tst).style
                            if (tst.display==&quot;block&quot;) {
                               tst.display=&quot;none&quot;
                            }
                         }
                     }
                  }
               }
               if (variant) {
                  for (i=lvl; i>0; i--) {
                      tst=&quot;menu_&quot;+menu_num1+i
                      if (document.getElementById(tst)!=null) {
                         tst=document.getElementById(tst).style
                         if (tst.display==&quot;block&quot;) {
                               tst.display=&quot;none&quot;
                         }
                      }
                  }
               }
            }
            thisMenu = document.getElementById(currMenu).style
            if (thisMenu.display != &quot;block&quot;) {
               thisMenu.display = &quot;block&quot;
            }
            lastmenu=currMenu
         }
}

here's a page that works properly with this function, try to follow this:

Code:
<!DOCTYPE html
PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
&quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;>[/URL]

<head>
      <title>Course Area Contacts</title>

      <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/schemes/blue/css/colour.css&quot; />
      <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/schemes/global/css/content.css&quot; />
      <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;custom_menu1.css&quot; />

      <script type=&quot;text/javascript&quot;>
              var offset_orig=0
              var num_lvls=3
      </script>

      <script type=&quot;text/javascript&quot; src=&quot;menu_sys.js&quot;></script>
</head>

<body style=&quot;white-space: nowrap&quot;>

      <div><h1>Course Areas</h1></div>

                  <div class=&quot;subheading&quot;><a href=&quot;#&quot; onclick=&quot;domenu('menu_10',0,false)&quot;><h2>Arts & Education</h2></a></div>

                       <span class=&quot;menu&quot; id=&quot;menu_10&quot;><a href=&quot;#&quot; onclick=&quot;domenu('menu_11',0,false)&quot;><h3>Journalism, Communication, Applied Theatre</h3></a>

                             <span class=&quot;submenu&quot; id=&quot;menu_11&quot;>Dr. Stephen Stockwell<br />
                             Telephone: (07) 555 28871<br />
                             Room: G23 3.22<br />
                             Campus: Gold Coast<br />
                             Email: S.Stockwell@griffith.edu.au</span>

                       <a href=&quot;#&quot; onclick=&quot;domenu('menu_12',0,false)&quot;><h3>Vocational Technology & Arts Education</h3></a>

                          <span class=&quot;submenu&quot; id=&quot;menu_12&quot;>Dr. Tony Millett<br />
                          Telephone: (07) 3875 5672<br />
                          Room: M15 1.05<br />
                          Campus: Mt. Gravatt<br />
                          Email: T.Millett@griffith.edu.au</span>

                       <a href=&quot;#&quot; onclick=&quot;domenu('menu_13',0,false)&quot;><h3>Criminology & Criminal Justice</h3></a>

                          <span class=&quot;submenu&quot; id=&quot;menu_13&quot;>Assoc. Prof. Tim Prenzler<br />
                          Telephone: (07) 3875 5613<br />
                          Room: M10 3.30<br />
                          Campus: Mt. Gravatt<br />
                          Email: T.Prenzler@griffith.edu.au</span>
                       </span>

                  <div class=&quot;subheading&quot;><a href=&quot;#&quot; onclick=&quot;domenu('menu_20',0,false)&quot;><h2>Business & Law</h2></a></div>

                       <span class=&quot;menu&quot; id=&quot;menu_20&quot;><a href=&quot;#&quot; onclick=&quot;domenu('menu_21',0,false)&quot;><h3>International Business & Asian Studies</h3></a>

                             <span class=&quot;submenu&quot; id=&quot;menu_21&quot;>Mr. Ken Bennett<br />
                             Telephone: (07) 3875 7922<br />
                             <span style=&quot;margin-left: 68px&quot;>(07) 3382 1162</span><br />
                             Room: N16 1.37<br />
                             <span style=&quot;margin-left: 42px&quot;>L04 1.17</span><br />
                             Campus: Nathan<br />
                             <span style=&quot;margin-left: 56px&quot;>Logan</span><br />
                             Email: K.Bennett@griffith.edu.au</span>

                       <a href=&quot;#&quot; onclick=&quot;domenu('menu_22',0,false)&quot;><h3>Marketing & Management</h3></a>

                          <span class=&quot;submenu&quot; id=&quot;menu_22&quot;>Ms. Megan Piggott<br />
                          Telephone: (07) 55 52 8768<br />
                          Room: G01 2.08<br />
                          Campus: Gold Coast<br />
                          Email: M.Piggott@griffith.edu.au</span>
                       </span>

                  <div class=&quot;subheading&quot;><a href=&quot;#&quot; onclick=&quot;domenu('menu_30',0,false)&quot;><h2>Engineering</h2></a></div>

                       <span class=&quot;menu&quot; id=&quot;menu_30&quot;><a href=&quot;#&quot; onclick=&quot;domenu('menu_31',0,false)&quot;><h3>Civil, Coastal, & Electronic</h3></a>

                             <span class=&quot;submenu&quot; id=&quot;menu_31&quot;>Mr. David Edwards<br />
                             Telephone: (07) 55 52 8663<br />
                             Room: G09 1.26<br />
                             Campus: Gold Coast<br />
                             Email: D.Edwards@griffith.edu.au</span>

                       <a href=&quot;#&quot; onclick=&quot;domenu('menu_32',0,false)&quot;><h3>Microelectronic</h3></a>

                          <span class=&quot;submenu&quot; id=&quot;menu_32&quot;>Mrs. Carol-Joy Patrick<br />
                          Telephone: (07) 3875 5007<br />
                          Room: N44 3.35<br />
                          Campus: Nathan<br />
                          Email: CJ.Patrick@griffith.edu.au</span>
                       </span>
      </body>

</html>
hopefully this will solve your problem and sorry about the wrapped lines
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top