OT: need javascript/DOM help

Bassel Safadi bassel.safadi at gmail.com
Fri Jun 20 23:20:25 UTC 2008


> What I'm trying to accomplish is to "display:none" or "display:block" the
> following element whenever the <a> is onclicked.
>

Maybe this will help you to accomplish the flip flop part of your situation

<script type="text/javascript">
function flipflop(element){
var foo;
foo = document.getElementById(element);
if(foo.style.display != 'block')
{
foo.style.display = 'block';
}
else
{
foo.style.display = 'none';
}
}
</script>

now you can simply:
<a onclick="flipflop('SOME_ELEMENT');">Flip Flop some thing</a>

if this isn't what you need or if you can't apply the nextSibling thing on
the above function, then please tell...


>
> As you pointed out "document.getElementById()" returns not the id, but the
> href.  (That really puzzles me and differs from the O'Reilly books on
> Javascript and Dynamic HTML).
>
> Is this a known bug?  If it is I will have to wrap my tags in such a way
> that I can find the other node relative to it some other way.
>

it may be a known bug for Mozilla like browsers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080621/3e9a944f/attachment-0001.htm>


More information about the fedora-list mailing list