[thelist] RE: javascript - changing css with javascript

.jeff jeff at members.evolt.org
Sat Sep 28 23:02:00 CDT 2002


> From: Dru and Cindy Sellers
> function cssMenu(obj)
> {
>   document.getElementById(" + obj + ").style.display =
>  (document.getElementById(" + obj + ").style.display ==
>  'none') ? 'block' : 'none';
> }
> however, I can not seem to find the right term to search
> on that explains how to use a variable in the
> getElementById() function. It seems to want a string in
> quotes in the () but if I just put (obj) it does not
> work.

lose the quotes in the function above.


then, it'll all depend on how you're calling the cssMenu() function.  call it and pass a string that's the id of an object on the page you want to toggle the display of.


good luck,


jeff at members.evolt.org

More information about the thelist mailing list