JavaScript and client side scripting.
Moderator: General Moderators
cturner
Forum Contributor
Posts: 153 Joined: Sun Jul 16, 2006 3:03 am
Location: My computer
Post
by cturner » Sun Jul 22, 2007 6:43 pm
Okay I give up. What I am trying to do is: when Company in the eligibilitytype combo box is selected it is meant to display select1 combo box. I have posted the code that I have been working with, below. Can someone please help me solve this problem? Thanks in advance.
Code: Select all
function dropdown1() {
var srcElement = document.getElementById('select1');
var a = document.getElementById('eligibilitytype');
if(a == "Company") {
srcElement.style.visibility = "visible";
} else {
srcElement.style.visibility = "hidden";
}
}
Code: Select all
<select name="eligibilitytype" id="eligibilitytype" onchange="dropdown1();">
Code: Select all
<select name="select1" id="select1" style="visibility: hidden">
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jul 22, 2007 6:54 pm
"a" won't be a string, but an object or undefined.
cturner
Forum Contributor
Posts: 153 Joined: Sun Jul 16, 2006 3:03 am
Location: My computer
Post
by cturner » Sun Jul 22, 2007 7:08 pm
feyd wrote: "a" won't be a string, but an object or undefined.
Can you please show me how I solve that problem?
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Jul 22, 2007 7:21 pm
cturner wrote: feyd wrote: "a" won't be a string, but an object or undefined.
Can you please show me how I solve that problem?
You'll need to access it's properly and not the object itself
change
Code: Select all
document.getElementById('eligibilitytype')
to
Code: Select all
document.getElementById('eligibilitytype').value