Steve Day

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromSteve Day
ToMe
SubjectAdding html and plain text to the current document
Date7 June 2005 17:02
Hello can you help me with an annoying problem.

I am trying to create a page that contains Javascript Functions. I have the
functions create a list of buttons with the "document.write" phrase, however
when i use this phrase in a function the browser creates a new document
without the javascript functions in the head section. Therefore i cant
reference them.

Is there any way of using javascript to write html to the current document
without clearing the current html and code it contains....?

Thans so much for any help you can give

Steve Day
FromMe
ToSteve Day
SubjectRe: Adding html and plain text to the current document
Date7 July 2005 17:14
Steve,

> "document.write" - the browser creates a new document

This is intentional. After the page completes loading, document.write will
assume you want to write a new document. (This is discussed on
http://www.howtocreate.co.uk/tutorials/javascript/writing )

> Is there any way of using javascript to write html to the current
> document without clearing the current html and code it contains....?

Yes, this is what the DOM does. I have covered how to do this in the DOM
section of my tutorial.

http://www.howtocreate.co.uk/tutorials/javascript/domintroduction
http://www.howtocreate.co.uk/tutorials/javascript/dombasics

Hope this helps

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromSteve Day
ToMe
SubjectRe: Adding html and plain text to the current document
Date7 June 2005 21:35
Tarquin
Thanks for your response, i have read exstensively your website and found it
wonderfuly helpful...i can change the text of a node but it shows HTML tags
as text and doesnt format the text...so i guess i have some more reading to
do...

Thanks again
Steve
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.