Test browsers: ie8 (compatible and incompatible modes), ff6.
var chk = document.createElement("input");
chk.setAttribute("type","checkbox");
container.appendChild(chk);
chk.setAttribute("checked",true);
Above The code does not always work in ie8 compatibility mode and ff6, but it does not work in ie8 incompatibility mode. It only works after appendChild and then setting the checked value, as follows:
var chk = document.createElement("input");
chk.setAttribute("type ","checkbox");
chk.setAttribute("checked",true);
container.appendChild(chk);
It seems that the above paragraph is reversed.