Results 1 to 2 of 2

Thread: Getting values of select box

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    Getting values of select box

    I am trying to retrieve the value of some selects on my page i am trying this

    var day = document.form2.F_C_DAY.selectedIndex.value
    var month = document.forms.form2.F_C_MONTH.value
    var year = document.forms.form2.F_C_YEAR.value


    but alerting them gives undefined. what am i doing wrong

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Try:

    Code:
    var year = document.forms('form2').F_C_YEAR.value
    That is assuming that the name of the form is 'form2', not just the second form on the page.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width