On Feb 6, 11:30 am, Michael Landberg <goodmin...@hotmail.com> wrote:
> On 6 feb, 11:52, GArlington <garling...@tiscali.co.uk> wrote:
>
>
>
> > On Feb 6, 8:28 am, Michael Landberg <goodmin...@hotmail.com> wrote:
>
> > > Hi
>
> > > I have a piece of code that has to open a new small window with some
> > > formatting text in it. If I run the code and the new windows opens the
> > > text is displayed without the formatting ( spaces, open lines between
> > > some text, etc.). But when I place an alert function like
> > > alert(newContent) I can see perfectly all the formatting that is in
> > > the text.
>
> > > Is there a variable I have to add in my code below to make sure that
> > > the new window is opened with the text formatting?
>
> > > newWindow =
> > > window.open('','','width=500,height=300,left=550,t op=250",status=no,toolbar*=no,scrollbars=yes ,
> > > menubar=no');
>
> > > // write HTML to new window document
> > > newWindow.document.write(newContent)
>
> > > Any help will be appreciated.
>
> > > Regards
>
> > Check the docs about how document.write() works and you will see the
> > error of your ways...- Tekst uit oorspronkelijk bericht niet weergeven -
>
> > - Tekst uit oorspronkelijk bericht weergeven -
>
> Hi
>
> I don't understand what you mean. I have read online what this
> function does and saw examples of it. But I cannot find out what I am
> doing wrong. Which docs do you mean?
document.write() OVERWRITES your complete document...
So, you have to put ALL <html> <body> ... </body> </html> in your
string in order for the document to be formatted as html, otherwise it
is plain text...
|