Possible Duplicate:
IE only javascript error with getElementsByTagName
var rows=myTable.getElementsByTagName('tr');
rows=Array.prototype.slice.call(rows,0);
在 IE 中不起作用,有没有其他方法可以将其转换为真正的数组,以便我可以对其使用排序函数...?
最佳答案
如果 IE 版本 < 8,则需要使用循环。
var rows=myTable.getElementsByTagName('tr');
var row_array = [];
for (var i = 0; i < rows.length; i++) {
row_array.push(rows[i]);
}
关于javascript - Array.prototype.slice.call 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12550356/