table合并相同单元格的问题 谁能解决,感激不尽,都来看看啊 因为前面的列已经合并掉了,不见了,所以每次只找0开始的列就好了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script type="text/javascript"> function mc(tableId, startRow, endRow, col) { var tb = document.getElementById(tableId); if (col >= tb.rows[0].cells.length-0) { return; } if (col == 0) { endRow = tb.rows.length - 1; } for (var i = startRow; i < endRow; i++){ var subCol = tb.rows[0].cells.length - tb.rows[startRow].cells.length; if (tb.rows[startRow].cells[col-subCol].innerHTML == tb.rows[i + 1].cells[0].innerHTML) { tb.rows[i + 1].removeChild(tb.rows[i + 1].cells[0]); tb.rows[startRow].cells[col-subCol].rowSpan = (tb.rows[startRow].cells[col-subCol].rowSpan | 0) + 1; if (i == endRow - 1 && startRow != endRow) { mc(tableId, startRow, endRow, col + 1); } } else { mc(tableId, startRow, i + 0, col + 1); startRow = i + 1; } } } mc('table1', 0, 0, 0); </script> 确实是,你真是帮了我的大忙了 ,太谢谢你了 javascript如何编写比对两张相片内容是否一样的代码 这个Javascript编程是怎么一回事?css:function(el, targetclass, action){?前台就包含一下这个文件就可以用了。 js 内存溢出 XML解析错误:未组织好如何解决? 急 急 急!!! JavaScript 滚动条无法动态添加的问题? overflow FF 兼容问题 有关checkbox的问题 动态添加行的新增和页面加载问题 100分急救! 如何得到当前浏览器的版本号? 对话框创建成功,但样式没起作用 这个JS是什么写法啊,都不认识求给解释一下?可以只解释语法。
<script type="text/javascript">
function mc(tableId, startRow, endRow, col) {
var tb = document.getElementById(tableId);
if (col >= tb.rows[0].cells.length-0) {
return;
}
if (col == 0) {
endRow = tb.rows.length - 1;
}
for (var i = startRow; i < endRow; i++){
var subCol = tb.rows[0].cells.length - tb.rows[startRow].cells.length;
if (tb.rows[startRow].cells[col-subCol].innerHTML == tb.rows[i + 1].cells[0].innerHTML) {
tb.rows[i + 1].removeChild(tb.rows[i + 1].cells[0]);
tb.rows[startRow].cells[col-subCol].rowSpan = (tb.rows[startRow].cells[col-subCol].rowSpan | 0) + 1;
if (i == endRow - 1 && startRow != endRow) {
mc(tableId, startRow, endRow, col + 1);
}
} else {
mc(tableId, startRow, i + 0, col + 1);
startRow = i + 1;
}
}
}
mc('table1', 0, 0, 0);
</script>