[thelist] Javascript: Long lines of code
Aylard JA (James)
jaylard at equilon.com
Thu Feb 22 15:25:29 CST 2001
Asif,
> Does anyone know how I can break a really long
> Javascript line into multiple lines. The code I want
> to break down into multiple lines is
Yes. But I'm not sure which question you are asking.
If you're asking, "How can I break up this long string in my source
code so that I can read it without horizontally scrolling the page in my
editor?", it's very straightforward:
alert ("The chair of the committee should be an " +
"instructional faculty with a regular academic " +
"appointment, Assistant Professor or higher, from the " +
"department awarding the degree. He must hold a Ph.D or " +
"its equivalent doctoral research degree");
If, on the other hand, you're asking, "How do I break up this long
string so that the alert box is narrower and easier to read?", it's also
straightforward (I'm actually combining the two techniques here):
alert ("The chair of the committee should be an" +
"\ninstructional faculty with a regular academic" +
"\nappointment, Assistant Professor or higher, from the" +
"\ndepartment awarding the degree. He must hold a Ph.D or" +
"\nits equivalent doctoral research degree");
The main thing here is the line-break character, \n.
hth,
James Aylard
More information about the thelist
mailing list