Gossamer Forum
Home : General : Internet Technologies :

Javascript Problem

Quote Reply
Javascript Problem
Scenario:

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:

Code:

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


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.
Subject Author Views Date
Thread Javascript Problem Lee 4782 Dec 29, 2005, 11:37 AM
Thread Re: [Lee] Javascript Problem
Andy 4585 Jan 2, 2006, 12:57 AM
Post Re: Javascript Problem
mkp 4406 Feb 26, 2006, 6:50 AM