onChange select pulldown lists - onChange select pulldown lists

They have: 5,633 posts

Joined: Jan 1970

I have two select pulldown lists. What I'm wanting to do is when you choose something from the first list, the options of the second list changes according to what you chose. How is this done??

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

I'm pretty sure it is possible, but I'm not quite sure how to code it. There are a few people here that have more experience in the form area that should be able to help out though. Smiling

They have: 2,390 posts

Joined: Nov 1998

Hmmm, I saw this done on the link exchange site when signing up for the banner service - take a look at that and see if that is what you need...
JP

----------
The Webmaster Forums General Administrator
[red]Why not visit:[/red] The Next Step in Website Development - http://www.what-next.com

They have: 8 posts

Joined: Mar 1999

This link demonstrates a pulldown with a select box:

http://www.hotwired.com/webmonkey/98/04/index3a_page10.html?tw=javascript

Flicki

They have: 5,633 posts

Joined: Jan 1970

Here is a script that will change the names and the values. You setup the values in the following arrays.

var newSelectionName = new Array();
newSelectionName[0] = "NAME1";
newSelectionName[1] = "NAME2";

var newSelectionValue = new Array();
newSelectionValue[0] = "VALUE1";
newSelectionValue[1] = "VALUE2";

function changeSelections() {
document.FORM.SELECT.options.length = 0;
for (i=0; i<.newSelectionName.length-1; i++) {
eval("document.FORM.SELECT.options[" + i + "] =
new Option(newSelectionName[" + i + "],newSelectionValue[" + i + "])");
} document.FORM.SELECT.options[0].selected = true;
}

----------
[email protected]
vegas.com.au/~jasper

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.