Sign in to follow this  

[web] [JavaScript] Erasing all existing document text

This topic is 4017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a web page which is built from a PHP script. Clicking on an element pops up a new window, which has its content generated by some javascript code. The editor window contains a form which posts its information back to original page. When the original page detects that data has been posted to it, it echoes a window.close(); and this closes the popup window automatically. The original page that popped up the dialog detects this event, and so refreshes itself to display the updated content. This works perfectly, except for one small case - sometimes I want the window to submit to the original page, but then reopen itself. Now, this too works, but the issue is that because of the structure of the site when the editor window is submitted you can see the site banner. This isn't a problem normally as it closes almost instantly, but if I need to display the editor again it's now off the bottom of the dialog. I haven't found a way to empty the dialog without some other bizarre side effects. The closest I've got is window.document.body.innerHTML = ' ';, which clears it but then IE displays a page loading error message. I could always close the dialog, and then programatically reopen it, but the popup blocker stops this from working.

Share this post


Link to post
Share on other sites
Well, in case anyone is interested; rather than trying to clear the page immediately, I use setTimeout() to call the editor function with a delay of zero. This executes after the page has fully loaded, so as it writes the new data it reopens the document first, clearing it.

Share this post


Link to post
Share on other sites

This topic is 4017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this