Click to See Complete Forum and Search --> : Constructing string
Lykaina
08-09-2003, 06:49 PM
Hi,
I have this code piece:
while (x < Matrix) {
CharPi = eval(NumberPI.charAt(x));
SeqChars = Caracteres[CharPi];
x++
SeqLongB = win.document.write(SeqChars);
}
The problem I have is how to construct a string *outside* the WHILE mode to split it into substrings? Whenever I try it returns only the first letter of the WHILE process, only.:(
Khalid Ali
08-09-2003, 11:50 PM
win.document.write(SeqChars); ????
can you elaborate what exactly is that you are trying to do?
document.write should be used with care since it could over write the document andhence moving the rest of the code to out of scope for the previous document..
Lykaina
08-10-2003, 06:20 AM
OK,
it's part of
case "PI" :
var message="Para os caminhos PI ou PHI a seqüência deve conter exatamente 10 letras!\nA sua seqüência tem " + SeqChars +" caracteres";
if (SeqChars < 10 || SeqChars > 10) {
alert(message); return false;
}
Caracteres = [Seq.substring(0,1),Seq.substring(1,2),Seq.substring(2,3),Seq.substring(3,4),Seq.substring(4,5),Seq.s ubstring(5,6),Seq.substring(6,7),Seq.substring(7,8),Seq.substring(8,9),Seq.substring(9,10)];
x = 0;
y = 1;
SeqLongA = win.document.write("<font face='ANACOM' size=" + Size + " color=" + FColor + ">");
while (x < Matrix) {
CharPi = eval(NumberPI.charAt(x));
SeqChars = Caracteres[CharPi];
x++
y++
SeqLongB = win.document.write(SeqChars);
}
SeqLong = win.document.write("</font>");
break;
Te other variables are listed in the upper part of the whole .JS document, and part of a greater script. Nothing much; I just want to put into a string what I get from the transformation of NumberPI into Seq... I don't think it's necessary to transcribe the whole though.
Lykaina
08-10-2003, 06:24 AM
... unless there's another way to list the results of the transformation from the NumberPI string into SeqChars besides using the print method that never ocurred to me...
I'm not an expert; maybe that's why I can't explain better my intent...
Charles
08-10-2003, 06:25 AM
We don't ned the whole wcript so much as we need you to explain in English what exactly the script is trying to do. You have a number of things there that are raising red flags.
Lykaina
08-10-2003, 06:29 AM
Sorry, I did not mean to be rude... I just made the mistake to translate my text and maybe that sounded aggressive in English ...