• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Javascript - how do I insert text into a document?

notfred

Lifer
I have a page that uses javascript to write text (using document.write()) to a page when a button is clicked. The problem is that the entire page is replaced wit the result of the document.write() call. How can I do something similar but jsut insert the result of document.write() into the existing document?

Thanks.
 
I am not that familiar with javascript but i know in most scripting languages there are two ways to open the file. One will append to the end and the other will overwrite. Try looking into something like that. I know with perl it is the difference of > and >>. Hope this is some help.
 
Originally posted by: SpomaMewor
I am not that familiar with javascript but i know in most scripting languages there are two ways to open the file. One will append to the end and the other will overwrite. Try looking into something like that. I know with perl it is the difference of > and >>. Hope this is some help.

Javascript is a web scripting language. I'm not opening any files. I'm modifying a currently open HTML document.
 
You can write into a text field, and use CSS to remove the borders of the text field..

I haven't tried the CSS part but I think it should work.. put something like "border: none;"
 
Try this.

With this technique, you can tightly control where you place the text and even what style it gets.
 
Back
Top