htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
"document.write" kills html???


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


ehammond
Novice

May 29, 2003, 5:47 AM

Post #1 of 3 (1471 views)
Shortcut
"document.write" kills html??? Can't Post

I have been having trouble with htmlArea where the html that is being stored contains a "document.write" javascript statement. It seems that when the html is viewed using htmlArea the "document.write" statement actually modifies the html in the editor.

Is there a way to turn this off, or get around this problem? I have not noticed the same problem in a previous editor that I was using.

-- Eric H.


Benjamin
Staff


May 29, 2003, 1:39 PM

Post #2 of 3 (1462 views)
Shortcut
Re: [ehammond] "document.write" kills html??? [In reply to] Can't Post

Hi Eric,

Yeah, the problem is that the htmlArea will actually execute the javascript when certain events happen, like booting up or when it refreshes its contents. As a neat example, if you were to switch to textedit mode and enter this...

<SCRIPT>document.write("Another one!<br>")</SCRIPT>

... then every time you toggle back and forth from textedit to richtext modes, it'll execute the javascript statement, printing another "Another one!" line to the content. Kind of a pill.

Workarounds... hmm. Any possibility of you tacking the code onto the htmlArea content after the form is submitted? This would rather depend on your precise situation, but you could have a second (non-wysiwyg) textarea field where you could insert your javascript, then in the editor_filterOutput() function, it could read in the contents of this second textarea and add it to htmlArea stuff. That way you'd evade the problem...

...? Not great. Unsure
Ben
interactivetools.com


sobko1
New User

Jun 11, 2003, 6:44 PM

Post #3 of 3 (1409 views)
Shortcut
Re: [Benjamin] "document.write" kills html??? [In reply to] Can't Post

Here's a better idea. Just write a function that checks to see if you are on the page that holds htmlArea, and do the document.write only if you are not:

<SCRIPT>
function htmlAreaWrite(s) {
if (document.location.href.search("pageWithHtmlArea.htm") == -1) {
document.write(s);
}
}
</SCRIPT>


then call that function instead of document.write

kind of cheesey, but it works.

--sobko

 
 
 


Search for (options)