By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,480 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,480 IT Pros & Developers. It's quick & easy.

Linked dropdowns

P: n/a
I am still learning more of Javascript, so please bear with me.

My objective is to have a dropdown list for categories. Depending upon
what the user clicks, I want the subcategories dropdown to change
content. I am sure this has been done many times and a pointer would be
helpful. I googled, but didn't find anything (Maybe because I don't
know the right keywords to use). The back end server code is in php, so
an ASP solution is not viable.

My idea is to attach and onchange to the category dropdown. Depending
upon the value in that dropdown, I would read the contents of a file on
the server and via innerHTML change the contents of the subcategory
dropdown list. In my googling, all I seem to come up with is reading
from the user's machine. These files would be on the server, so it
really should be much easier, but I haven't found it.

I know I can do this with php, however that involves either regenerating
the page or using AJAX. I am looking to see if there is a straight
javascript solution.

BTW, if there is a better way I am totally open to suggestions.
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
sheldonlg wrote:
I am still learning more of Javascript, so please bear with me.

My objective is to have a dropdown list for categories. Depending upon
what the user clicks, I want the subcategories dropdown to change
content. I am sure this has been done many times and a pointer would be
helpful. I googled, but didn't find anything (Maybe because I don't
know the right keywords to use). The back end server code is in php, so
an ASP solution is not viable.

My idea is to attach and onchange to the category dropdown. Depending
upon the value in that dropdown, I would read the contents of a file on
the server and via innerHTML change the contents of the subcategory
dropdown list. In my googling, all I seem to come up with is reading
from the user's machine. These files would be on the server, so it
really should be much easier, but I haven't found it.

I know I can do this with php, however that involves either regenerating
the page or using AJAX. I am looking to see if there is a straight
javascript solution.

BTW, if there is a better way I am totally open to suggestions.

I did it with an AJAX technique.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.