0

I have this code to add row to my table

    function addRow(tableID){
    var table=document.getElementById(tableID);
     var rowCount=table.rows.length;
    var row=table.insertRow(rowCount);
    var colCount=table.rows[0].cells.length;
    var cell1=row.insertCell(0);
    cell1.innerHTML= rowCount+1;
    for(var i=0;i<colCount;i++){
    var newcell=row.insertCell(i+1);
    newcell.innerHTML=table.rows[0].cells[i+1].innerHTML;
    }}

and this for AJAX function

    function CLO() {
    var a=document.getElementById("keyword").value;
    var b=document.getElementById("chapter").value;
        if (a == ""&& b == "") {
         document.getElementById("CLO").innerHTML = "";

        return;
            } else { 
     if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("CLO").innerHTML = xmlhttp.responseText;

            }
        }

        xmlhttp.open("GET","PLO.php?q1="+escape(a)+"&q2="+escape(b),true);
        xmlhttp.send();
             }
            }

How I can use the same function in the added rows
it working in the first row
I need you recommendation and help
thank you

2
Contributors
1
Reply
35
Views
2 Years
Discussion Span
Last Post by lps
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.