Results 1 to 2 of 2

Thread: Using javascript need to add a row dynamically on click of a button

  1. #1
    Join Date
    Feb 2007
    Rep Power

    Default Using javascript need to add a row dynamically on click of a button

    The scenario is :
    When the user clicks on the Add Button a row should get added to the table dynamically.But i need this table to be created at a specific position in the form (as shown in bold below form structure):

    I have two functions out of which, in one i am creating my html elements using javascript and in the other i am handling my button events.
    The thing is as shown below:

    function createHtml(){
          1. TextField
          2. Add Button1
         3.Dynamic table to be created on the click of Add Button1
          4.Add button2
          5.Dynamic table to be created on the click of Add Button2
    function handleEvents(e){
            eventHandling code.
    Now as shown in the above function when the user clicks on Add Button1 i want a row to be get added at the Postion3.And this is to be done everytime the button is clicked at that specific postion only.

    Can anybody please help me in achieving this task.

  2. #2
    Join Date
    Sep 2005
    Sunnyvale, CA
    Rep Power


    Not sure how much detail you're asking for, so here's the basics...

    Assuming you have a reference to the TABLE element, all you would need to do is call "insertRow" on the TABLE and pass in an index value of where in the table you want to insert. Passing in "-1" will append to the end of the table.

    To tie everything together, add an onclick handler to each of the buttons. In the handler code, either get a reference to the TABLE if it exists via an ID or create one by calling document.createElement("TABLE").

    Bugzilla - Wiki - Downloads - Before posting... Search!

Similar Threads

  1. Sent, Sent Items, Sent Messages
    By scottp in forum Administrators
    Replies: 13
    Last Post: 04-14-2011, 06:36 AM
  2. need advice on configuring zimbra to work with fax server
    By pheonix1t in forum Administrators
    Replies: 0
    Last Post: 07-11-2007, 07:46 PM
  3. Zimbra + Samba LDAP, cannot add winxp
    By fajarpri in forum Installation
    Replies: 4
    Last Post: 07-08-2007, 11:45 AM
  4. Admin Panel add domain finish button broken
    By tomicles in forum Developers
    Replies: 2
    Last Post: 10-08-2005, 10:09 PM

Posting Permissions

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