Hello everyone.
I have several divs that are hidden and I need to show only one when a
button is clicked.
I solved this problem with Prototype quite easily like so:
The HTML:
<form id="form">
<div id="t1" class="tlist" style="display:none">
foo
</div>
<input type="button" onClick="javascript:show_div('fom', 't1',
'tlist')">
and so on...
</form>
The JavaScript:
function show_div(form, id, divclass) {
($(form).getElementsByClassName(divclass)).invoke('hide');
$(id).show();
}
This works, but it lacks the Web 2.0 glamour, so I tried this:
function show_div(form, id, divclass) {
($(form).getElementsByClassName(divclass)).invoke('hide');
new Effect.SlideDown(id);
}
Now, this works with 1 div, but if I have more than 1 I get this error
message:
element.down() has no properties
var oldInnerBottom = element.down().getStyle('bottom');
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---