Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/337.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
Jquery 如何调整html表格行的大小_Jquery_Html - Fatal编程技术网

Jquery 如何调整html表格行的大小

Jquery 如何调整html表格行的大小,jquery,html,Jquery,Html,我有两个html表,它们的内容都是动态生成的,两行也是固定的。我必须调整两个表的行高,以便两个表和行高具有相同的高度。情况是,两张桌子的高度都应该调整,使两张桌子看起来像一张桌子。 我有下面的代码,它可以与Mozilla一起工作,但不能在IE中工作。建议代码也可以与IE一起工作 使用的文件:jquery-1.3.2.js for (rIndex = 1; Number(rIndex) < Number(totalrows); rIndex = Number(rIndex) + 1) {

我有两个html表,它们的内容都是动态生成的,两行也是固定的。我必须调整两个表的行高,以便两个表和行高具有相同的高度。情况是,两张桌子的高度都应该调整,使两张桌子看起来像一张桌子。 我有下面的代码,它可以与Mozilla一起工作,但不能在IE中工作。建议代码也可以与IE一起工作

使用的文件:jquery-1.3.2.js

for (rIndex = 1; Number(rIndex) < Number(totalrows); rIndex = Number(rIndex) + 1) {
    var lRowH = $('#tblTopLeft').find("tr").eq(rIndex).height();
    var rRowH = $('#tblRightTop').find("tr").eq(rIndex).height();

    if (Number(lRowH) > Number(rRowH)) {
        $('#tblRightTop').find("tr").eq(rIndex).css('height', $('#tblTopLeft').find("tr").eq(rIndex).css('height'));

    }
    else {
        $('#tblTopLeft').find("tr").eq(rIndex).css('height', $('#tblRightTop').find("tr").eq(rIndex).css('height'));

    }
}
for(rIndex=1;Number(rIndex)编号(rRowH)){
$('tblRightTop').find(“tr”).eq(rIndex).css('height'),$('tblToplet').find(“tr”).eq(rIndex).css('height');
}
否则{
$('tblTopLeft').find(“tr”).eq(rIndex).css('height'),$('tblRightTop').find(“tr”).eq(rIndex).css('height');
}
}

首先升级到JQuery的新版本

有一种功能叫做
.addClass()
.removeClass()

与向现有样式添加属性相比,使用这些属性要好得多

您要做的是创建两个样式块;一个在事件发生之前,一个在事件发生之后

当事件发生时,删除原始样式并添加新样式。

-请查看此项。编辑:对不起,我没有读完整的问题。让我再检查一遍。这是:)只需使用高度函数本身,而不是基于Gasim解决方案的CSSb:。在Fx8和IE9中测试。假设两个表中的行数相等。