Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 表IE8中的单元格索引问题_Javascript_Internet Explorer 8 - Fatal编程技术网

Javascript 表IE8中的单元格索引问题

Javascript 表IE8中的单元格索引问题,javascript,internet-explorer-8,Javascript,Internet Explorer 8,在使用Chrome和Firefox时,下面这句话给我在IE8中带来了麻烦: this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex]; IE8返回“对方法或属性访问的意外调用”。我尝试了其他地方推荐的修复方法,使用getCellIndex(this)而不是this.cellIndex,并添加了: function getCellIndex(aCell) { aRow = aCell.paren

在使用Chrome和Firefox时,下面这句话给我在IE8中带来了麻烦:

this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
IE8返回“对方法或属性访问的意外调用”。我尝试了其他地方推荐的修复方法,使用
getCellIndex(this)
而不是
this.cellIndex
,并添加了:

function getCellIndex(aCell) {
    aRow = aCell.parentNode;
    for (i = 0; i != aRow.cells.length; i++) {
        if (aRow.cells[i] == aCell) return i;
    }
}
…并被告知“cells.length为null或不是对象”

如有任何关于如何进行的建议,将不胜感激。以下功能的相关部分,故障在第6行:

$tableHeaders = $(c.selectorHeaders, table)
            .wrapInner("<div class='tablesorter-header-inner' />")
            .each(function(index) {
                $t = $(this);
                ch = c.headers[index];
                this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
                this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
                this.count = -1; // set to -1 because clicking on the header automatically adds one
                if (ts.getData($t, ch, 'sorter') === 'false') { this.sortDisabled = true; }
                this.lockedOrder = false;
                lock = ts.getData($t, ch, 'lockedOrder') || false;
                if (typeof(lock) !== 'undefined' && lock !== false) {
                    this.order = this.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
                }
$tableHeaders=$(c.selectorHeaders,table)
.wrapInner(“”)
.每个(功能(索引){
$t=$(此项);
ch=c.标题[索引];
this.column=header_index[this.parentNode.rowIndex+“-”+this.cellIndex];
this.order=formatSortingOrder(ts.getData($t,ch,'sortInitialOrder')| | c.sortInitialOrder)?[1,0,2]:[0,1,2];
this.count=-1;//设置为-1,因为单击标题会自动添加一个
if(ts.getData($t,ch,'sorter')='false'){this.sortDisabled=true;}
this.lockedOrder=false;
lock=ts.getData($t,ch,'lockedOrder')| | false;
if(typeof(lock)!='undefined'&&lock!==false){
this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1]:[0,0,0];
}

解决方案是使用jQuery来处理这种不兼容性。jQuery有一个索引()函数,这似乎是您所需要的。@dystroy:
单元格
在IE中工作得很好。jQuery可能不会有多大帮助。一些HTML在这里会有所帮助。实际上,jQuery.Edited已经深入到了jQuery.Edited中。如果您使用jQuery,为什么不将
this.cellIndex
替换为
$(this.index()