sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-27 12:33 UTC
Element.hide Element.show giving me trouble
Not sure how to fix this - right now I have 4 tabs on my page, and 4
related divs. Goal is that when tab is clicked, 3 of the divs hide, 1
shows. The first 2 seem to work right, but once I got to tab 3 or 4
then the hides stop working and all the divs start showing.
Not sure if I coded this right:
Code :
<ul id="tabnav">
<li class="tab1"><a href="#"
onclick="Element.hide(''canbackground'',
''canposition'',''canskill'');
Element.show(''basicinfo''); return false;">Basic
Info</a></li>
<li class="tab2"><a href="#"
onclick="Element.hide(''basicinfo'',
''canposition'',''canskill'');
Element.show(''canbackground''); return
false;">Background</a></li>
<li class="tab3"><a href="#"
onclick="Element.hide(''basicinfo'',
''canbackground'',''canskill'');
Element.show(''canposition''); return
false;">Preferences</a></li>
<li class="tab4"><a href="#"
onclick="Element.hide(''basicinfo'',
''canbackground'',''canposition'');
Element.show(''canskill''); return
false;">Skills</a></li>
TIA
Stuart
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
How about?
Script:
function view (obj) {
[''basicinfo'',''canbackground'',''canposition'',''canskill''].without(obj).each(Element.hide);
Element.show(obj);
}
And:
<ul id="tabnav">
<li class="tab1"><a href="#"
onclick="view(''basicinfo'')">Basic
Info</a></li>
<li class="tab2"><a href="#"
onclick="view(''canbackground'')">Background</a></li>
<li class="tab3"><a href="#"
onclick="view(''canposition'')">Preferences</a></li>
<li class="tab4"><a href="#"
onclick="view(''canskill'')">Skills</a></li>
</ul>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---