JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 26th, 2005, 01:53 PM
liljoeyjordison liljoeyjordison is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 12 liljoeyjordison User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 22 sec
Reputation Power: 0
Cool Sublink style navigation

Hi, I want to make a navigation very similar to macromedia's with the sublinks appearing on mouseover. However I don't want them to dissapear on mouseout.

I have div tags with the same class but different ID's. How can i use links with mouseover events to acheive to switch which ones are visible?

Reply With Quote
  #2  
Old September 27th, 2005, 04:16 AM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 3
Talking I think I might have something for you.

I think I might have something for you.
The following function is used to show only one DIV at a time from a list of multiple DIVs.
Code:
  function ShowInfo(id)
  {
    i = 0;
    while(1)
    {
      el = document.getElementById('info_'+i);
      if(el)
      {
        if(id == i)
        {
          el.style.display = el.style.display == 'none' ? '' : 'none';
        }
        else
        {
          el.style.display = 'none';
        }
      }
      else
      {
        break;
      }
      i++;
    }
  }

The DIVs (or TD or whatever) are sequentially named like:
Code:
<div id="info_0" style="display: none">First DIV</div>
<div id="info_1" style="display: none">Second DIV</div>
<div id="info_2" style="display: none">you get the point</div>

The call ShowInfo(1) will show the div with info_1.
Then ShowInfo(0) will hide info_1 and show info_0.
Then ShowInfo(0) will hide info_0 again.

You can add DIVs as you like without changing the function! As long as you number them sequentially
Comments on this post
Itsacon agrees: Neat solution, mate...

Reply With Quote
  #3  
Old September 28th, 2005, 05:33 AM
liljoeyjordison liljoeyjordison is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 12 liljoeyjordison User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 22 sec
Reputation Power: 0
Quote:
Originally Posted by MichaelSoft
You can add DIVs as you like without changing the function! As long as you number them sequentially

Nice touch! That works perfectly. Thanks a million!

Reply With Quote
  #4  
Old September 28th, 2005, 06:37 AM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 3
Quote:
Originally Posted by liljoeyjordison
Nice touch! That works perfectly. Thanks a million!

You're welcome. Can we see the result somewhere???

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Sublink style navigation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway