View Full Version : Select field difficulty

08-01-2006, 11:25 AM
The following function is used to find the currently selected options in three select fields than add the time in seconds into another selection field as a value.

The days() function is to fill the selection box 'days' with days for that month.

It currently works perfectly in firefox but is having difficulty in Internet Explorer.

Here is (in basic) the script

NOTE: Timestamp automatically inserted by php, just encase your wondering why it would be static.

I have written this up with very basic knowledge of javascript, so all corrections are welcome :)

Thanks in advance, Matt.

08-02-2006, 04:18 AM
onclick event in option tag doesn't work in IE, just use onchange in select tag as you used in the other selects. And another thing, onclick is supported in select tag but it's not good to use it because if the user uses arrow keys to select items, onclick event will not be triggered. So call days() inside calc_timestamp() and since calc_timestamp() is called on other selects, pass a parameter to know it is called from the day select.

08-02-2006, 07:09 AM
This does not seem to be the problem, day, month and year in the function calc_timestamp() are returning empty, no errors and no data.
If i add alert( day ); below day, it returns the alert empty.

The only way it seems to work is if i add the value tag, how would i return the text inside the <option> tag ?

The onclick is working successfully in IE7 (not sure about IE6 but have done as you suggested anyway)

EDIT: I have added value='value' inside the <option> tags and everything is working as it should now. I assumed that the data inside the <option> tag was assigned the value if no value was present. With firefox, this is the case but not IE.

Thanks for your time.

08-02-2006, 09:49 AM
value and text are different attributes of the options..

08-02-2006, 10:49 AM
Cheers, thats what i was needing :thumbsup: