from function get the value of html array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nicolas
    New Member
    • Jan 2007
    • 24

    from function get the value of html array

    how i going to get the array value of my body tag...???
    this is my function code...

    *** where the index is index of array, e.g. i pass index value as 0
    function Remove(index) {
    alert(document. frmPopUp.arrIte m(index).value) ;
    document.frmPop Up.arrItem(inde x).value="";
    frmPopUp.submit ();
    }

    inside the body i got
    <input type="hidden" name="arrItem(< %=i%>)" value="<%= arrItem(i)%>">

    and then ...when i press the buton, it will call the function Remove
    but i cant get the value...i geting error on the script.

    any one can help ....
    thx...
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I'm not sure but I don't think you can declare names like that. Why not just use
    [HTML]<input type="hidden" name="arrItem<% =i%>" value="<%=arrIt em(i)%>">[/HTML] so there's no need for brackets? Then you can access the form value using:
    Code:
    alert(document.frmPopUp["arrItem" + index].value);
    document.frmPopUp["arrItem" + index].value="";

    Comment

    • Nicolas
      New Member
      • Jan 2007
      • 24

      #3
      Originally posted by acoder
      I'm not sure but I don't think you can declare names like that. Why not just use
      [HTML]<input type="hidden" name="arrItem<% =i%>" value="<%=arrIt em(i)%>">[/HTML] so there's no need for brackets? Then you can access the form value using:
      Code:
      alert(document.frmPopUp["arrItem" + index].value);
      document.frmPopUp["arrItem" + index].value="";
      acoder, thx its work

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        No problem. Glad I could help.

        Comment

        Working...