Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to clear documnet.writeln before writing

Status
Not open for further replies.

dheeraja

Programmer
Jul 8, 2002
8
0
0
CA
I am calling a javascript function on button click in parent window wherein i am opening a popup window and writing html to it. the popup is created and displaying information correctly. the problem is that if the button in paraent window is clicked again, the information is appended to existing information in popup i.e i have two identical sets, each subsequent click of button adds an extra set. how can i avoid this?
 
You need to make sure that you close the document when you have finished writing:

document.close();

This will prevent you from writing any additional information to the page.



Rich
 
Yep, that works just fine!
Could you also tell me how to make this popup a modal window. i.e. if the user tries to click elsewhere on the parent window, he/she is automatically brought back to this window. I was thinking of the onBlur event handler but that is just for some form elements.
Thanks in advance.
 
You can use onBlur() in the <body> tag too.

<body onBlur='this.focus'>

Just tested this in IE5.5 to be sure and works fine - should work in NS6, too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top