Some of the browser incompatibilities that I have seen.

1. When creating a table using document.createElement

In mozilla, this works:

var tblObj = document.createElement(“table”);

Now, if we append it to a div called divObj in the DOM

divObj.appendChild(tblObj);

In IE this does not work. You have to create a tbody and append the tbody to the table and then append the table to the DOM.

var tblObj = document.createElement(“table”);

var tbodyObj = document.createElement(“tbody”);

tblObj.appendChild(tbodyObj );

divObj.appendChild(tblObj);

2. Creating a drop down using document.createElement

var selObj = doc.createElement(“select”);

var optObj = doc.createElement(“option”);

optObj.text= “foo”;

selObj.appendChild(optObj);

divObj.appendChild(selObj);

In IE optObj.text= “foo”; does not work. Have to use innerHTML.

optObj.innerHTML = “foo”;

3. While using frames this is the way to refer to the child frame from the parent frame.

window.parent.frames.<name of your frame>

I was doing this in another way before, which I do not remember exactly. It used to work on firefox in my windows laptop but not on firefox running on mac.

Advertisements