
10/09/2006, 03:09
|
| | Fecha de Ingreso: septiembre-2006
Mensajes: 9
Antigüedad: 18 años, 7 meses Puntos: 0 | |
Dar formato a un texto en tiempo de ejecucion
Código:
// TENGO UNA MATRIZ CON NUMEROS
numeros = ["0", "1", "2", "3", "4", "5"];
// Y OTRA VACIA
numeros2 = [""];
// A LA VACIA LE QUITO EL 1ER. VALOR PORQUE ESTA EN BLANCO
numeros2.shift();
// QUIERO LLENAR LA 2ª MATRIZ CON 9 NUMEROS ALEATORIOS COGIDOS
// DE LA MATRIZ 1.
for (var i = 0; i<9; i++) {
numeros2.push(numeros[Math.floor(Math.random()*numeros.length)]);
}
// AHORA QUIERO QUE LOS REPRESENTE EN UN CAMPO DE TEXTO QUE TENGO EN
// EL ESCENARIO, PERO QUIERO QUE CADA 3 NUMEROS INSERTE UN SALTO DE LINEA
// PERO NO SE POR QUE INSERTA UN SALTO DE LINEA DESPUES DE CADA NUMERO
// Y LO HACE INCLUSO SI PRESCINDO DE LA ETIQUETA <BR>
for (var i in numeros2) {
texto_txt.html = true;
texto_txt.multiline = true;
if (texto_txt.length%3 == 0) {
texto_txt.htmlText += numeros2[i]//+"<BR>";
} else {
texto_txt.htmlText += numeros2[i];
}
}
// YO QUIERO QUE QUEDE ASI:
// (Suponiendo que salieran estos numeros)
// 134
// 234
// 456
|