Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Select field difficulty

    Hey,
    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
    http://cast-control.net/js-001.html

    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.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    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.

  • #3
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by Extreme43; 08-02-2006 at 07:24 AM.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    value and text are different attributes of the options..
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New Coder
    Join Date
    Mar 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers, thats what i was needing


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •