js 浏览器兼容问题,除了ie10其他浏览器都有弹出效果
<script language="JavaScript">
function selectOver() {
var _topDocument = top.opener.document;
var _table = _topDocument.getElementByid("maintable1");
cleanWhitespace(_table);
var length = _table.lastChild.childNodes.length;
if (length > 3
|| _table.rows[length - 2].cells[0].childNodes[0].value == 1) {
var row = _table.lastChild.lastChild.previousSibling;
var _tr = _table.lastChild.insertBefore(row.cloneNode(true),
_table.lastChild.lastChild);
}
var index = _table.lastChild.childNodes.length - 2;
var col = document.formB.elements;
for ( var i = 0; i < col.length; i++) {
if (col[i].name == "radiolect" && col[i].checked) {
_table.rows[index].cells[0].childNodes[0].value = index;
_table.rows[index].cells[0].childNodes[1].setAttribute("name",
"itemid_" + index);
_table.rows[index].cells[0].childNodes[1].value = col[i].value
.substring(0, col[i].value.indexOf("+"));
_table.rows[index].cells[1].innerHTML = col[i].value.substring(
col[i].value.indexOf("+") + 1, col[i].value
.indexOf("#"));
_table.rows[index].cells[0].childNodes[1].setAttribute("src",
col[i].value.indexOf("#") + 1, col[i].value.indexOf("*"));
}
}
close(self);
}
function back() {
close(self);
}
function cleanWhitespace(element) {
for ( var i = 0; i < element.childNodes.length; i++) {
var node = element.childNodes[i];
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
node.parentNode.removeChild(node);
}
}
</script>
------解决方案--------------------1,childNodes这种写法不是好习惯,不同的浏览器childNodes数量不同
2,getElementById