I presume the problem is that your page is already loaded when you call the
document.write
Document.write must (normally) only be used within inline code before the
page finish rendering.
E.g.:
Hello
<script>
//inline code
document.write("world")
//code not inline
function docWrite()
{
document.write("world")
}
</script>
<button onclick=docWrite()>...</button>
=> you'll have hello world in your page + button because the document.write
actually put the write content in the html flow => the browser engine start
opening the document, read 1st line "Hello", put it in it, then execute the
inline code and insert the result, and so on until all reading is done.
At this point the document is loaded and render => no problem the write is
withing the rendering flow.
BUT if code is not inline the document is already loaded and a document
write start a new empty document content => finally you'll just have "world"
in your page all previous copntent is discarded.
To avoid this use the DOM to put the content you want in the existing
document.
Hope this helps.
"ramy m" <ramymoneiry@y...> wrote in message
news:271253@j..._howto...
>
> hi all
>
> when I use document.write ("dasjdsa") ;
>
> it prints on a new page and not on the same page where I am working . how
> can I pass the same page therefor document.write () will print on the same
> screen ???
>
>
> thanks
>
>