Variable textboxname or form name

Discussion in 'JavaScript' started by dhrubajyoti, Jun 15, 2010.

  1. #1
    Hi,

    I am very new to Javascript but need a small help.

    I want to have something like
    document.formname.tboxname.value ->Here I want to have the tboxname as a variable.

    How to do that?
     
    dhrubajyoti, Jun 15, 2010 IP
  2. dhrubajyoti

    dhrubajyoti Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Somebody plz reply...
     
    dhrubajyoti, Jun 15, 2010 IP
  3. dhrubajyoti

    dhrubajyoti Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ???

    PLease...
     
    dhrubajyoti, Jun 15, 2010 IP
  4. tdemetri

    tdemetri Peon

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    give your element a unique id such as id="myTextBox"

    then you can access either the name value of an input text ( if it has a name ) by
    document.getElementById("myTextBox").name

    or access the id by
    document.getElementById("myTextBox").id
     
    tdemetri, Jun 15, 2010 IP
  5. dhrubajyoti

    dhrubajyoti Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks...I guess it will be solved
     
    dhrubajyoti, Jun 16, 2010 IP