InsertRow And InsertCell
Mar 21, 2003Can anyone tell me what supports insertRow and insertCell? Also, can anyone provide me with links to DOM documentation for browsers other than IE?
View 6 RepliesCan anyone tell me what supports insertRow and insertCell? Also, can anyone provide me with links to DOM documentation for browsers other than IE?
View 6 RepliesI have a function where it add rows into a table. For the example below it adds a row under the Question column, (I have not included whole function as there is a lot of code so instead I have just posted the relevant code.This is inside a function
var row = document.createElement("tr");
var cell
input,
[code]....
I have a problem with FireFox. I have written a function to Add rows without submiting the form. This function works fine in IE, but not in FireFox.
The function is :
function createRows(deviceId,deviceType,modelName,ipAddress,macAddress,imageURL)
{
oTable=document.getElementById("tab:tabForm: oTable");
var oRow1=oTable.insertRow(oTable.rows.length);
var aRows=oTable.rows;
var aCells=oRow1.cells;
var oCell1_1=aRows(oRow1.rowIndex).insertCell(aCells.length);
var oCell1_2=aRows(oRow1.rowIndex).insertCell(aCells.length);
var oCell1_3=aRows(oRow1.rowIndex).insertCell(aCells.length);
var oCell1_4=aRows(oRow1.rowIndex).insertCell(aCells.length);
var oCell1_5=aRows(oRow1.rowIndex).insertCell(aCells.length);
var oCell1_6=aRows(oRow1.rowIndex).insertCell(aCells.length);
oCell1_1.innerHTML="<input>";
oCell1_2.innerHTML="";
oCell1_3.innerHTML="<font>"+modelName+"</font>";
oCell1_4.innerHTML="<font>"+ipAddress+"</font>";
oCell1_5.innerHTML="<font>"+macAddress+"</font>";
oCell1_6.innerHTML="<input>";
}
Can anyone please tell me what's the feature that is not supported in Firefox that makes this function not work in the same.
this is probably very simple but I cannot seem to figure it out and i tried looking around but i couldnt find anything on it.I am using Ajax insertrow which is working fine, however I have it in a loop and I want to alternate the rows colors, anyone know what call i have to use to change the background color of the current row?
Code:
AddRowMe = 1;
for(var i in response)
[code]....
It appears that using the insertCell method to append a cell to a table row in the tbody creates a data cell by default. I need to create a header cell (in the tbody, not in the thead). Is this possible? The desired result would be something like this:
<table>
<tbody>
<tr>
<th>#text</th> <-- I am unable to create this element.
<td>#text</td>
<td>#text</td>
</tr>
</tbody>
</table>
I've a problem with cells generated by insertCell, I need to add
"onclick" event something like this
html+=' <td class='+ClassSelection+' id='+i+'-'+j
+' onclick='+this.GetName()+'.Select('+i+','+j+');'
+ this.GetName()+'.Draw(true);>'
+actual.Text+'</td>
'*/
to generate something like:
<td class="class" id=1-3 onclick=main.Select(1-3);main.Draw(true);>
sometext </td>
with DOM I'm doing something like
var cell=row.insertCell(-1);
cell.innerHTML=actual.Text;
cell.className=ClassSelection;
cell.id=i+'-'+j;
and that works but I don't know how to do to generate the "onclick"
part
I have a table that looks like:
And a function to add a row and cells in the row that looks like:
The problem is the insertCell won't insert that first cell with an x in it (which will allow users to click on the x button to delete the row) in the first cell in Google Chrome. Firefox inserts a row with the first cell containing the x button but no other cells with the text boxes.
I've tried setting the index on the cell insert to 0, 1, 8, nothing and Chrome either inserts a row with nothing in it (no text boxes, no x button, nothing other than a slight addition of space below the title row) or it adds the row correctly except the x button always winds up in the last cell. IE adds it correctly with no index value or 0. Firefox needs the 0 index (no index creates a blank row with nothing in it. It looks like there's a tiny blank row of nothing being inserted because you see the table get a tiny bit larger vertically but there is no x button, text boxes.
What am I doing wrong? How do I make this work in all 3 browsers? Well actually all browsers ideally but....
Further, if I supply the 0 index to get a row, clicking on the x button to delete it works correctly in IE and Chrome but does nothing in Firefox.
That code looks like:
So what is wrong with both the addRow and removeRow functions that is causing Chrome and Firefox to behave incorrectly?