SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to make Add, Delete function on Table using innerHTML

    My dear Pro programmers.. i'm facing a problem on my javascript project. my school not allow me use DOM to create a table, and use DOM to add row or delete row. somemore wan to display on it... They want me use innerHTML, i'm no idea how to use innerHTML. i hope someone can teach me here. i will paste my screenshot for the main screen of the program.I hope someone can help me. THx a lot

  2. #2
    SitePoint Zealot trekmp's Avatar
    Join Date
    Dec 2005
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    UNTESTED

    The simplest way is to create a div where you would like to have your table and give it an id of something like id="jsTable"

    Now the javascript.

    To build the table its just a case of building a large String variable

    var myTable='<table summary="blah blah" border="1">';
    myTable+="<tr><th>Name</th><th>Quantity</th></tr>";
    myTable+="</table>";

    Of course you'll need to add more to it than this to fill it with your data

    To output the details to the screen you just need to do

    document.getElementById('jsTable').innerHTML=myTable;
    Why do we exist? What is our purpose?
    >H2O Developments
    >USS Endeavour
    >Hosted@Servage


Bookmarks

Posting Permissions

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