baluba
02-17-2007, 09:17 AM
I use this code to add a table in my iframe as rich text editor.
function insertTable(rows, columns, border, cellpadding, cellspacing) {
var html="";
html += '<table width="100%" border="'+border+'" cellspacing="'+cellspacing+'" cellpadding="'+cellpadding+'">';
html += '<tbody>';
for(var j = 0; j < rows; j++) {
html += "<tr>";
var width = 100/columns;
for(var i = 0; i < columns; i++) {
html += "<td valign=\"top\" width=\""+width+"%\"></td>";
}
html += "</tr>";
}
html += "</tbody>";
html += "</table>";
sml(html);
this.close();
}
function sml(code){
if (opener.document.frames("Composition").document.selection && opener.document.frames("Composition").document.selection.createRange()) {
opener.document.frames("Composition").document.focus();
var sel=opener.document.frames("Composition").document.selection;
var rng=sel.createRange();
rng.pasteHTML(code);
}
}
How can I add new rows to this table clicking the icon "Add new row" ?
function insertTable(rows, columns, border, cellpadding, cellspacing) {
var html="";
html += '<table width="100%" border="'+border+'" cellspacing="'+cellspacing+'" cellpadding="'+cellpadding+'">';
html += '<tbody>';
for(var j = 0; j < rows; j++) {
html += "<tr>";
var width = 100/columns;
for(var i = 0; i < columns; i++) {
html += "<td valign=\"top\" width=\""+width+"%\"></td>";
}
html += "</tr>";
}
html += "</tbody>";
html += "</table>";
sml(html);
this.close();
}
function sml(code){
if (opener.document.frames("Composition").document.selection && opener.document.frames("Composition").document.selection.createRange()) {
opener.document.frames("Composition").document.focus();
var sel=opener.document.frames("Composition").document.selection;
var rng=sel.createRange();
rng.pasteHTML(code);
}
}
How can I add new rows to this table clicking the icon "Add new row" ?