Passing Multiple value textbox without loading page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    Passing Multiple value textbox without loading page

    using <input values> text box to another text box in sort of array function to passing multiple value without loading page on one click of button

    Code:
    <script type='text/javascript'>
    function test(el){
        while(el.tagName != 'FORM')
            el = el.parentNode;
        var input = el.getElementsByTagName('INPUT');
        var elementString = '';
        for(var i=0; i<input.length; i++)
            elementString += input[i].name + '=' + input[i].value + '&';
        elementString = elementString.substring(0, elementString.length - 1);
        alert(elementString);
    }
    </script>
    <form name='example'>
    <table>
     <tr><th>Item 1</th><td><input name='item1' value="1"></td></tr>
     <tr><th>Item 2</th><td><input name='item2' value="2"></td></tr>
     <tr><th>Item 3</th><td><input name='item3' value="3"></td></tr>
     <tr><th>Item 3</th><td><input name='item4' value="4"></td></tr>
     <tr><th>Item 3</th><td><input name='item5' value="5"></td></tr>
    <tr><td colspan=2><input name='button' value='submit me' type='button' onclick='test(this)'></form>
    <form name='example2'>display values<input name='ite1'><input name='ite2'><input name='ite3'><input name='ite4'><input name='ite5'></form>
    </td></tr></table>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    passing multiple value in just one click of button.
    er, you always pass all input elements* when submitting a form.


    * - exceptions are unselected radio buttons/checkboxes

    Comment

    • Fary4u
      Contributor
      • Jul 2007
      • 273

      #3
      without loading a page passing values 1 text box to another text box.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Code:
        input_a[i].value = input_b[j].value
        PS. the better you explain, the better can I answer

        Comment

        • Fary4u
          Contributor
          • Jul 2007
          • 273

          #5
          thxs dormilich can u be more specific ?

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            not with the given information.

            Comment

            Working...