looping through an HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elsheh
    New Member
    • Nov 2006
    • 29

    looping through an HTML

    Hi. Everyone
    I’m trying to loop through an html document to perform some tasks. The html document contains a couple of input boxes which gather the data from the user. However, to complete my task I need to get the name of each input box and the value of entered data. The former is archived by these statements:
    var myelements=docu ment.getElement sByTagName("inp ut");
    for (var i=0;i< myelements.leng th;i++){
    var boxname=myeleme nts[i].name
    var boxvalue=
    Unfortunately, I stuck with how to get the input box’s value.

    Any help is much appreciated

    Cheers
  • korinth
    New Member
    • Apr 2007
    • 5

    #2
    have you tried using .value?

    it seems like if you're trying to get whatever is in the input field, myelement[i].value should work. at least if it's a text field.

    if it is another form of input, like a radio button or a checkbox, you have to specify the value in the tag.

    Comment

    • elsheh
      New Member
      • Nov 2006
      • 29

      #3
      Thanks Korinth
      Actually it’s a text field. But, unfortunately element[i].value doesn’t work. any clue?
      Cheers

      Originally posted by korinth
      have you tried using .value?

      it seems like if you're trying to get whatever is in the input field, myelement[i].value should work. at least if it's a text field.

      if it is another form of input, like a radio button or a checkbox, you have to specify the value in the tag.

      Comment

      • elsheh
        New Member
        • Nov 2006
        • 29

        #4
        thanks alot Korinth
        got it.
        cheers
        Originally posted by elsheh
        Thanks Korinth
        Actually it’s a text field. But, unfortunately element[i].value doesn’t work. any clue?
        Cheers

        Comment

        Working...