[Javascript] Setting default selection in dropdown
Esther Strom
emstrom at interaccess.com
Thu Aug 2 15:26:21 CDT 2001
Hi, everyone. I'm new to this group (I was an active member of the
list several years ago, but got away from JS for a while.) Anyway,
here's the problem. I have several menus (selects) on a form. I save
the last used selection to a cookie when the user leaves or shuts
down. I need to somehow set the default selected item to the cookie
value when the page is opened again.
I can read the cookie value back with no problem, but how do I set the
default selected value without knowing the selectedIndex of the
cookie? (I thought of saving the selectedIndex number to the cookie
too, but because the dropdown select is populated from a database,
there may be new records added between the time the cookie is saved
and when it's accessed. This will make the selectedIndex # wrong.)
Any ideas?
Thanks,
Esther Strom
More information about the Javascript
mailing list