shankwheat wrote:
<select name="ddlProfiles"
onchange="location.href=frmProfiles.ddlProfiles.op tions[selectedIndex].value;addOption_list()">
Is it possible to call 2 different functions using the onChange event
from a selectbox? What I have here isn't working - addOption_list()
never gets called.
Thanks
Well, your problem isn't calling 2 different functions from the
onchange event. Look closely - the first thing you're doing is
inducing a page reload, so the page reloads and basically wipes clean
all javascript state. You basically start from scratch. You've got a
couple of options here...
1. store state in a cookie, which your script reads on window load,
though some users have cookies turned off;
2. try to avoid reloading your page, through Ajax or some other
technique;
3. do your addOption_list() in your window.onload handler, assuming
it's something you always want to do no matter what page contents you
have;
4. sending a command across reload as an URL parameter
(
http://myurl.com/?cmd=addOption_list) that you read in your
window.onload handler using code like var args =
window.location.search.split('&');
probably other options here as well, but basically you're stepping into
advanced javascript terrain here, where you're preserving session
information across page loads. Lots of good stuff out there in
Google-land on this; front-end devs have some quite sophisticated
techniques for doing this sort of thing, but it's a huge field out
there that deserves some general study.
-David