Anyone can help me how to delete a record using the "DOM" or another good
implementation for grid in html ?
Help!


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>

<body bgcolor="#FFFFFF">
<script>
  idCounter=1
  function addRow() {

    startPt=document.getElementById("resultTableBody")
    dataA=document.createTextNode( document.form1.text_name.value );
    dataB=document.createTextNode( document.form2.text_id.value);
     dataC=document.createTextNode( idCounter.toString(10) );

    dataC_ahref=document.createElement("a");
    dataC_ahref.setAttribute("href", "#" );


    tdTabA=document.createElement("td")
    tdTabB=document.createElement("td")
    tdTabC=document.createElement("td")


    dataC_ahref.appendChild( dataC );
    trTab=document.createElement("tr")
    trTab.setAttribute("id", idCounter.toString(10) );

    tdTabA.appendChild( dataA )
    tdTabB.appendChild( dataB )
    tdTabC.appendChild( dataC_ahref )

    trTab.appendChild( tdTabA )
    trTab.appendChild( tdTabB )
    trTab.appendChild( tdTabC )




    startPt.appendChild( trTab )
    idCounter=idCounter+1

  }

  function delRow() {
    //startPt=document.getElementById("resultTableBody");
    //for (i=0; i<=startPt.childNodes.length - 1; i++) {
     //   if (startPt.childNodes[i].childNodes[2].childNodes[0].checked) {
     //      startPt.removeNode(); }
    //}
     startPt=document.getElementById("2");
     while (startPt.hasChild()) {
       startPt.removeNodes();
     }

  }




</script>

<table width="100%" border="0">
  <tr>
    <td>
      <table width="100%" border="0">
        <tr>
          <td width="6%">Name:</td>
          <td width="21%">
            <form name="form1" >
              <input type="text" name="text_name">
            </form>
          </td>
          <td width="2%">ID:</td>
          <td width="27%">
            <form name="form2" >
              <input type="text" name="text_id">
            </form>
          </td>
          <td width="21%">
            <form name="form3" >
              <input type="button" name="Button" value="Add" onclick
="addRow()">
              <input type="button" name="Button" value="Delete All" onclick
="delRow()">
            </form>
          </td>
          <td width="23%">&nbsp; </td>
        </tr>
      </table>
      <table id="resultTable" width="100%" border="0">
       <tbody id="resultTableBody">
       </tbody>
      </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </td>
  </tr>
</table>


</body>
</html>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to