cleary1981 Posted September 2, 2008 Share Posted September 2, 2008 hi, I have dynamically created a table of records from my database. What I want to do now is to add some functions to each row. Similar to the delete, amend in phpMyadmin beside each record. does anyone have an example of how this can be done. I have included my javascript. Please bare in mind the code I have in the price icon and view icon part doesnt work but you can probably see what I am trying to achieve here. function updateCompleteProjects() { //alert(request.readyState); if (request.readyState == 4) { //alert(""); var returned = request.responseText; //alert(""); var splitResult = returned.split("^"); for (var i=0;i<splitResult.length-1;i++) { var record = splitResult[i]; // alert(record); var splitRecord = record.split("$"); var tbl = document.getElementById('panels'); var lastRow = tbl.rows.length; var iteration = lastRow; var row = tbl.insertRow(lastRow); // cell number var cellLeft = row.insertCell(0); var textNode = document.createTextNode(iteration); cellLeft.appendChild(textNode); // company var cellcomp = row.insertCell(1); var t_comp = document.createTextNode(splitRecord[0]); cellcomp.appendChild(t_comp); // project var cellproj = row.insertCell(2); var t_proj = document.createTextNode(splitRecord[1]); cellproj.appendChild(t_proj); // project id var cellprojid = row.insertCell(3); var t_projid = document.createTextNode(splitRecord[2]); cellprojid.appendChild(t_projid); // price icon var cellprice = row.insertCell(4); var newObject1 = document.createElement('div'); var price = document.createElement("img"); price.src="price.png"; newObject1.appendChild(price); price.alt = "Price"; cellprice.appendChild(newObject1); // view icon var cellview = row.insertCell(5); var newObject = document.createElement('div'); newObject.Class ="view"; var ele = document.getElementsByTagName('div'); var view = document.createElement("img"); view.src="view.gif"; view.alt = "View"; newObject.appendChild(view); } getIncompleteProjects(); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.