
Nuestro asunto parece k se ha kdao estancao

He conseguido k se muestre el color= solo si se ha introducido un color y k si, ponga todo bien pero ni lo de los saltos de linea ni los [col] y [row] se ponen, saltan todos como [mcol] y [mrow] xk no toma en cuenta la linea en la que le digo InsertM = false;...
Aqui te pongo el codigo en cuestion (ya se k es muy largo, pero hay k tener en cuenta k es la primera vez k programo en JS...)
Código: Seleccionar todo
function BBCtable() {
var FoundErrors = '';
var enterBG = prompt("Por favor, introduzca el color de la tabla (deje la celda en blanco si no desea introducirlo)", "");
var enterROWS = prompt("Introduzca el numero de filas de la tabla", "2");
if (!enterROWS) {
FoundErrors += "Usted no introdujo el numero de filas. ";
}
var enterCOLS = prompt("Introduzca el numero de columnas de la tabla", "2");
if (!enterCOLS) {
FoundErrors += "Usted no introdujo el numero de columnas.";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ROWs_R = enterROWS;
var COLs_R = enterCOLS - 1;
var enterROWS_COLS = '';
var InsertM = true;
while (ROWs_R >= 0) {
if (InsertM = true) {
enterROWS_COLS += '[mrow]';
while (COLs_R > 0){
enterROWS_COLS += '[mcol]';
COLs_R -= 1;
}
InsertM = false;
COLs_R = enterCOLS - 1;
ROWs_R -= 1;
} else {
enterROWS_COLS += '\n[row]';
while (COLs_R > 0){
enterROWS_COLS += '[col]';
COLs_R -= 1;
}
COLs_R = enterCOLS - 1;
ROWs_R -= 1;
}
ROWs_R -= 1;
}
if (!enterBG){
var ToAdd = "[table]"+enterROWS_COLS+"[/table]";
} else {
var ToAdd = "[table color="+enterBG+"]"+enterROWS_COLS+"[/table]";
}
PostWrite(ToAdd);
}
Me intriga saber k sera. Salu2
