nystagmus
05-15-2003, 08:18 PM
Hello,
I'm not sure if JavaScript would be the easiest way to do this or not, but let me give a description of what I'm trying to accomplish.
On my company site, I have a feedback section where customers can put in their name, address, etc. I recently realized that I forgot to include an input for their country.
I have created a table with that has the label "Country" and then a drop-down selection to the right with the choices of "United States" and "Other". I have that accomplished.
I would then like to make a JavaScript event handler that will write "City", "State", and "Zip Code" sections onto the page when the user selects the U.S. as their country. If not, I want it to just leave everything normal so the user can put information into the "Address" section. If the user has already selected the U.S. but then selects Other, the code needs to remove the city, state, and zip code sections.
I would like to do this with document.write() etc., but I don't know how to invoke it when the user makes their selection.
Suggestions, comments, or code will be GREATLY appreciated.
Thanks for your time,
- Tim
P.S. - You may visit the work in progress at the following link. The borders are to aid me in lining the tables up correctly and will be removed when the page is completed.
http://www.cruisersplus.com/feedbacktest.htm
P.S.S. - I can use PHP or Perl if need be. It doesn't have to be JavaScript, but that is what I'm leaning towards at the moment. I'm at a stuck spot, so I'll just wait for responses.
I'm not sure if JavaScript would be the easiest way to do this or not, but let me give a description of what I'm trying to accomplish.
On my company site, I have a feedback section where customers can put in their name, address, etc. I recently realized that I forgot to include an input for their country.
I have created a table with that has the label "Country" and then a drop-down selection to the right with the choices of "United States" and "Other". I have that accomplished.
I would then like to make a JavaScript event handler that will write "City", "State", and "Zip Code" sections onto the page when the user selects the U.S. as their country. If not, I want it to just leave everything normal so the user can put information into the "Address" section. If the user has already selected the U.S. but then selects Other, the code needs to remove the city, state, and zip code sections.
I would like to do this with document.write() etc., but I don't know how to invoke it when the user makes their selection.
Suggestions, comments, or code will be GREATLY appreciated.
Thanks for your time,
- Tim
P.S. - You may visit the work in progress at the following link. The borders are to aid me in lining the tables up correctly and will be removed when the page is completed.
http://www.cruisersplus.com/feedbacktest.htm
P.S.S. - I can use PHP or Perl if need be. It doesn't have to be JavaScript, but that is what I'm leaning towards at the moment. I'm at a stuck spot, so I'll just wait for responses.