Re: JS write of new document

by "Srinivasan Ramakrishnan" <srinivar(at)md3.vsnl.net.in>

 Date:  Sun, 9 Jul 2000 21:56:43 +0530
 To:  "John Murray" <jmnc(at)lis.net.au>,
<hwg-languages(at)hwg.org>
 References:  opalintel
  todo: View Thread, Original
To answer your questions:

1)

|Is there a javascript technique that enables me to write an entire block
| of text like there is in perl say [ie. so I don't have to do
'document.write
| ..' for every line of the document]

No, but that doesn't mean there aren't work arounds.

var myBlockOfText = "<p>My block "
myBlockOfText += "of Text....................."
myBlockOfText += "...............some more text here"
....
.....
.....

and so on until you have as long a block of text as you want in the
variable.

This can be done in a single line too but it makes reading easier this way.

2)

| 2. I'm uncertain about whether to put the <html> tag as part of the new
| documents document.write build process. And what about building the new
| document with a javascript section. And are there any characters that I
have
| to escape [e.g comment tags] or use another technique to include them.

If you are opening the window thru JS as in the following code, you could
include the <HTML> tag.

BTW if you don't already know some older browsers will mistake a HTML
comment written thru JS as a termination signal and choke on the remaining
code. A workaround is to split the tags as "--" + "> and "<s" + "cript>"

var newWin = window.open("http:........",mywin,".......");

newWin.document.open();
newWin.document.write("All your html here");
newWin.document.close();

3)
| 3. What about the window title bar. Will a document.write of a
| <title></title tag work.


It will provided you are opening the window thru JS as in the prev.
question.





----- Original Message -----
From: John Murray <jmnc(at)lis.net.au>
To: <hwg-languages(at)hwg.org>
Sent: Sunday, July 09, 2000 5:27 PM
Subject: JS write of new document


| I'd like to take the values of a form in one window and use them as part
of
| the contents of another window.
|
| Questions:
|
| 1. Is there a javascript technique that enables me to write an entire
block
| of text like there is in perl say [ie. so I don't have to do
'document.write
| ..' for every line of the document]
|
| 2. I'm uncertain about whether to put the <html> tag as part of the new
| documents document.write build process. And what about building the new
| document with a javascript section. And are there any characters that I
have
| to escape [e.g comment tags] or use another technique to include them.
|
| 3. What about the window title bar. Will a document.write of a
| <title></title tag work.
|
| Thanks,
|
| John
|
|

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA