function view_detail(id) {
// delete detail rows
// create a new row with one cell in it
var main_table = document.getElementsByTagName('table')[0];
var table_row = document.getElementById('tr'+id);
var row_index = table_row.rowIndex;
var new_row = main_table.insertRow(row_index+1);
var cell_a = new_row.insertCell(0);
cell_a.colSpan = "7";
// create a input box
var textbox = document.createElement('input');
textbox.type = 'text';
textbox.name = 'txtRow' + id;
textbox.id = 'txtRow' + id;
textbox.size = 220;
cell_a.appendChild(textbox);
// trigger Ajax
xHRObject.onreadystatechange = getData(id);
xHRObject.open("GET", "log_detail.php?id="+id, false);
xHRObject.send(null);
}
function getData(id){
if ((xHRObject.readyState==4) && (xHRObject.status==200))
{
alert("yap");
var textbox = document.getElementById('txtRow'+id);
textbox.value = xHRObject.responseText;
}
}
No comments:
Post a Comment