It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Basic drop down menu...

Basic drop down menu...

Postby pe8fjn7k on Tue May 12, 2009 9:05 pm

Hey guys,
So I just want to create a basic drop down menu, here's the code I'm using and it works fine in Safari and FF mac, but not IE7:

Code: Select all
      <script type="text/javascript">
      <!--
          function toggle_visibility(id) {
             var e = document.getElementById(id);
             if(e.style.display == 'table')
                e.style.display = 'none';
             else
                e.style.display = 'table';
          }
         function visibility_off(id) {
            var e = document.getElementById(id);
            e.style.display = 'none';
          }
          function visibility_on(id) {
            var e = document.getElementById(id);
            e.style.display = 'table';
          }
      //-->
      </script>

Code: Select all
<a class='tab' href='#' onmouseover="visibility_on('services'); visibility_off('clients'); visibility_off('resources');">services</a>

Code: Select all

            <table id='services' style='display: none;' cellpadding="0" cellspacing="0">
               <tr>
                  <td style='background: url(<?php echo $root ?>images/row-1-row-2-drop-downs-top.png) no-repeat; height: 13px'></td>
               </tr>
               <tr>
                  <td class='drop-downs-middle'>
                     <a class='drop-down' href='website-design'>website design >></a>
                     <a class='drop-down' href='website-maintenance'>Website Maintenance >></a>
                     <a class='drop-down' href='search-engine-marketing'>Search Engine Marketing >></a>
                     <a class='drop-down' href='search-engine-optimization'>Search Engine Optimization >></a>
                     <a class='drop-down' href='hosting'>Hosting >></a>
                     <a class='drop-down' href='domain-name-acquisition'>Domain Name Acquisition >></a>
                     <a class='drop-down' href='custom-email-accounts'>Custom Email Accounts >></a>
                     <a class='drop-down' href='enewsletters'>eNewsletters >></a>
                     <a class='drop-down' href='adwords-campaigns'>AdWords Campaigns >></a>
                  </td>
               </tr>
               <tr>
                  <td><img src='<?php echo $root ?>images/row-1-row-2-drop-downs-bottom.png' /></td>
               </tr>
            </table>
pe8fjn7k
 
Posts: 2
Joined: Tue May 12, 2009 8:57 pm

Re: Basic drop down menu...

Postby rangana on Thu May 14, 2009 6:12 am

You should be aware that the table value for display property isn't supported on IE, which is the reason why it isn't showing.

I suggest you remove the word "table" on the display property and left the value into empty space. So this part:
Code: Select all
e.style.display == 'table'


...would now read:
Code: Select all
e.style.display == ''


Hope that helps.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Re: Basic drop down menu...

Postby pe8fjn7k on Thu May 14, 2009 5:45 pm

Ah yeah that worked! Hey thanks!
pe8fjn7k
 
Posts: 2
Joined: Tue May 12, 2009 8:57 pm


Who is online

Users browsing this forum: No registered users and 2 guests