PDA

View Full Version : Formatting code in JavaScript


basic3572002
01-02-2003, 01:05 PM
when i write in JavaScript its very hard to read because it to long.
do JavaScript has a _ line like Visual Basic

ex of Visual Basic


a = abc _
+ def

mordred
01-02-2003, 01:57 PM
I know the answer to your question, but seeing that you don't give a damn about the posting rule which clearly states to use a *descriptive* topic title, I'm not sure if I should reward such behaviour by posting the answer.

Other regulars may have similar opinions, though of course I can only speak for myself. Please think about it, ok? :)

Terry
01-02-2003, 02:05 PM
As long as your not in the middle of a string you can safely press enter in a statement for a newline:


var markup = ["<HTML>","<HEAD>",
"</HEAD>","<BODY BGCOLOR='"
+ myBgColor + "' TEXT='"
+ myTextColor + "' LINK='"
+ myLinkColor + "' VLINK='"
+ myVLinkColor + "'>","</BODY>","</HTML>"];



writeSpeed = sec(mod28Disp)
+ " seconds for 28.8 modem"
+ "\n\n" + sec(mod56Disp)
+ " seconds for 56kbs modem"
+ "\n\n" + sec(isdnDisp)
+ " seconds for isdn at 128kbs"
+ "\n\n" + sec(dslDisp)
+ " seconds for dsl or cable modem at 300kbs";


- Terry