I'm trying to addrow onclick button, and I need that new row would have the diffrent ids for "keyword" and "chapter" so I can pass the values of these two field in CLO(key, chap)
I can only call the CLO() function in orginal row I need to be able to call it in added row and get that row keyword and chapter
this my code, could you please help me with the code .thank you
<html><head>
<script>
function addRow(tableID){
var table=document.getElementById(tableID);
var rowCount=table.rows.length;
var row=table.insertRow(rowCount);
var colCount=table.rows[1].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[1].cells[i+1].innerHTML;
}}
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();
}
}
</script>
</head><body><form>
<input type="button" value="Add Question" onclick="addRow('dataTable')"><br> <br>
<table id="dataTable" >
<tr><th>Q</th><th>Keyword</th>
<th>Chapter</th>
<th>CLO</th>
<th> Marks</th></tr>
<tr><td> 1</td><td> <input type="text" name="keyword" id="keyword" > </td>
<td> <select name="chapter" id="chapter" onchange="CLO()"> <option value="" > </option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select></td>
<td id="CLO"> </td> </td>
<td> <input type="text" name="Assess_Mark"> </td></tr>
</table><form></body></html>