0
我想在單擊該選項時僅顯示錶格外邊框。代碼使用extjs和html實現。邊界屬性有2個值1和0,顯示邊界或隱藏它。我怎樣才能實現它的外部邊界。僅在HTML中使用表格外殼
這是生成表的函數。
generateHtmlTable = function (cols, rows, border) {
//Create Table
var tdWidth = 100/cols;
var classN;
//break-word only for IE
//Set the classes for each type of table
if(border==1){
classN = "table1";
} else {
classN = "table0";
}
var tempborder = "box";
var table = "<table bgColor=white border='"+border+"' width='100%' style=\"table-layout:auto word-wrap: break-word;\" class=\"" + classN +"\" cellpadding=0 cellspacing=0>";
for (var i = 0; i< parseInt(rows); i++) {
table += "<tr>";
for (var j = 0; j < parseInt(cols); j++) {
table += "<td class=\"" + classN +"\" width='" + tdWidth +"%' valign=\"top\"> </td>";
}
table += "</tr>";
}
table += "</table>";
return table;
}
這是設置邊框的功能。
setOutBorder: function(edt){
var rng = edt.getDoc().getSelection().anchorNode;
if (tables.validNode(rng)) {
tables.init(edt);
for(var i = 0; i < tbody.childNodes.length; i++){
for(var j = 0; j < tbody.childNodes[i].childNodes.length; j++){
tbody.childNodes[i].childNodes[j].className = "table0";
}
}
table.className = "tableOut";
table.border = 0;
//rng.select();
}
tables.refresh(edt);
}
謝謝你,但如何只顯示外邊框? –
你的意思是,只爲表格的邊界不爲td/tr是嗎? – jerry
是的,確切地說。我只需要表格邊框而不是td和tr。 –