Click to See Complete Forum and Search --> : Alert changes value


mdr
05-18-2004, 02:54 AM
Hi, can someone please help?
I have an onclick event on a select box which calls a javascript function. In this function I have an alert which displays the currently selectedIndex of the select box. However the value it displays is the previously selected index Unless I display another alert directly before the first one which could be anything.

It seems that displaying another alert box is doing some sort of flush or something?
Is there a command i need to run which displays the correct value without the need to display another alert box?

Thanks.

fredmv
05-18-2004, 03:50 AM
Originally posted by mdr
an onclick eventThis is precisely your problem right here; use onchange instead.

mdr
05-18-2004, 03:53 AM
Originally posted by fredmv
This is precisely your problem right here; use onchange instead.

I would use that but I need my code to work if the entry is already selected also, which in that case onchange wouldn't be triggered.