That's VERY elegant Jochem.

Thank you for that code!

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 02, 2006 4:10 PM
To: CF-Talk
Subject: Re: OT javascript Q: Show/hide divs...works in IE, not in FF.


Andy Matthews wrote:
>
> function switchDiv(pNode,name) {
>       var pNode = document.getElementById(pNode);
>       for (i=0;i<pNode.childNodes.length;i++) {
>               ci = pNode.childNodes[i];
>               if (ci.name != "undefined") {
>                       ci.style.display = "none";
>                       if (ci.name == name) {
>                               ci.style.display = "block";
>                       }
>               }
>       }
> }
>
> The goal is when I mouseover each of the links, the DIV specified in the
> function call gets shown while all other DIVs get hidden.

function switchDiv(pNode,name)
{
        var pNode = document.getElementById(pNode);
        var cDivs = pNode.getElementsByTagName("div");
        var tDiv = document.getElementByName(name);

        for (i=0;i<cDivs.length;i++)
        {
                cDivs[i].style.display = "none";
        }

        tDiv[0].style.display = "block";
}

Jochem



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231218
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to