IKA Works Laboratory equipment - Kamala Harris - Wordpress Themes - Anime Downloads - Debt Consolidation

PDA

View Full Version : question on HTML DOM Select Object


lunlun
Dec 14th 2007, 2:03 pm
To clarify, the thing i'm trying to insert is,
http://www.w3schools.com/htmldom/dom_obj_select.asp


I have a table and i want to insert a select object into one of the cell. but i am getting a "Type mismatch" error on line with code "cell.insertBefore(selectBox);"


I am running IE 6



var cRow = document.getElementById("displayCondition").insertRow(rowIndexDC++);

if (rowIndexDC % 2 == 0)
cRow.bgColor = "#cccccc";

var cell0 = cRow.insertCell(0);
var cell1 = cRow.insertCell(1);
var cell2 = cRow.insertCell(2);
var cell3 = cRow.insertCell(3);
var cell4 = cRow.insertCell(4);
var cell5 = cRow.insertCell(5);
cell5.align = "center";

if(rowIndexDC != 3) {
var selectBox = document.createElement('select');

var option = document.createElement('option');
option.text = "And";

try
{
selectBox.add(option, null); // standards compliant
}
catch(ex)
{
selectBox.add(option); // IE only
}


} cell1.insertBefore(selectBox, cell1.childNodes[0]);

MMJ
Dec 15th 2007, 4:22 am
I am running IE 6

Now why would you torture yourself like that?