Gossamer Forum
Home : General : Internet Technologies :

Javascript Problem

Quote Reply
Javascript Problem

I have a page with various categories, all hidden by <div>'s with a class of 'displayNone'. I have a drop-down selection box where when the user clicks on an option, the class of a specific <div> will change to 'displayBlock'.

My javascipipt is:


<script language="javascript">
function display_contractors(element) {
if (element) {
general_contractor.className = 'displayNone';
sub_contractor.className = 'displayNone';
carpentry.className = 'displayNone';
element.className = 'displayBlock';

element.className refuses to work. :(

If I change one of the first three to displayBlock, that category works.

If I do an "alert(element)" right before element.className, I get the appropriate element, so I know it is being passed.

What am I missing to make element.className = 'displayBlock' work?

Thanks in advance for your help.
Quote Reply
Re: [Lee] Javascript Problem In reply to

Is this a FireFox or IE issue? I know fireFox is a bit fussy in terms of using the display.visability function, as I had quite a few bugs with it a while back :(


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: Javascript Problem In reply to
How are you actually calling it? If 'element' refers to an element (and not its name or something stupid like that), you can change its properties. If you can't, there's some problem (with your code - or, I suppose, the version of the browser you are using).

Last edited by:

mkp: Feb 26, 2006, 6:50 AM