Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating and removing form fields

    Hey there, does anybody knows how to create-remove a new field in a form, using JS, Also is there any javascript api, something that depicts the functions and parameters etc...I have seen so many functions like the getElementsById, or document.something.something...... but dont know what to expect. having the api will no bother anymore


  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Round Rock, Texas
    Posts
    443
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, Document Object Model (DOM) will do it all, but there's a learning curve. VERY briefly it might look like this:
    Code:
    function buildTable () {
      var theTable = createObject ('table');
      var aTbody = createObject ('tbody');
      var aRow   = createObject('tr');
      var aCell   =  createObject('td');
    
      aRow.appendChild(aCell);
      aTbody.appendChild(aRow);
      theTable.appendChild(aTbody);
    }
    that's not even scratching the surface. DOM is a very rich and powerful API.


  •  

    Posting Permissions

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