W
Water Cooler v2
Besides embedding <BR/>, like general purpose programming languages, I
thought you could embed escape sequences such as \n or \r\n into string
arguments to cause line breaks in JavaScript.
To test, I tried this:
<BODY>
<BR/><BR/>
<SCRIPT Language="JavaScript" type="text/javascript">
<!--
document.write("<B>Hello, World!</B>"+'\r\n'+"OK! In my next example,
I am going to put one JavaScript function in...")
document.write("<B>Hello, World!</B>"+"\r\nOK! In my next example, I am
going to put one JavaScript function in...")
document.write("<B>Hello, World!</B>"+"\n"+"OK! In my next example, I
am going to put one JavaScript function in...")
document.write("<B>Hello, World!</B>"+'"r\n"+"OK! In my next example, I
am going to put one JavaScript function in...")
//-->
</SCRIPT>
</BODY>
None of it inserts a line break on the display text.
A second question I have is, when does one use single quote delimited
strings and when double-quote delimited strings? Is it like C, wherein
single character values must be emebedded in single-quotes whereas
character array literals (or strings, if you will) must be packaged in
double-quoted strings? Or is it loosely defined?
thought you could embed escape sequences such as \n or \r\n into string
arguments to cause line breaks in JavaScript.
To test, I tried this:
<BODY>
<BR/><BR/>
<SCRIPT Language="JavaScript" type="text/javascript">
<!--
document.write("<B>Hello, World!</B>"+'\r\n'+"OK! In my next example,
I am going to put one JavaScript function in...")
document.write("<B>Hello, World!</B>"+"\r\nOK! In my next example, I am
going to put one JavaScript function in...")
document.write("<B>Hello, World!</B>"+"\n"+"OK! In my next example, I
am going to put one JavaScript function in...")
document.write("<B>Hello, World!</B>"+'"r\n"+"OK! In my next example, I
am going to put one JavaScript function in...")
//-->
</SCRIPT>
</BODY>
None of it inserts a line break on the display text.
A second question I have is, when does one use single quote delimited
strings and when double-quote delimited strings? Is it like C, wherein
single character values must be emebedded in single-quotes whereas
character array literals (or strings, if you will) must be packaged in
double-quoted strings? Or is it loosely defined?