Sunday, December 9, 2007

Clearing a window ot frame

Clearing a window ot frame

I have written a small game yesterday. I have encountered a problem you might have got as well. If you want to clear a window or frame you look into the documentation by Netscape and see that JavaScript knows the function 'document.clear()'. But if you implement this function nothing happens! The function document.clear() seems to be broken on every platform. Gordon McComb gave me the following script which clears the window as I wanted it.

document.close();

document.open();

document.write("

");

You don't have to write document.write("

");. It is only important that you send anything to the window. This works fine with frames as well.

No comments: