javascript pop-up question

I am working on a form that will collect about 15 pieces of info and posts to itself. If all required fields are populated, I add the data to a database and redirect to a thank you page. If any of the required fields are not completed, I open a new window and write all of the errors to the new window. I then have a close button on the new window. However, if the user does not close the new window, resubmits the form and has additional errors, the pop-up window adds the errors to the previously created window. Here is what I would like to do:

1) Force the pop-up window to close before opening it.

2) Clear the data in the pop-up window before writing to it.

Are either of these possible? Here is my current script (I write the errors later using a combo of javascript and php):

<script LANGUAGE="JavaScript">

var newWindow
function makeNewWindow(url,width,height) {
{
}
newWindow = window.open(url,'','toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=' + width + ',height=' + height);
}

function openpopup(){
var popurl="info.htm"

newwindow=window.open("","newWin","width=400,height=280")
newwindow.focus()
newwindow.document.write("<HTML><BODY BGCOLOR='CCCCCC'></BODY></HTML>")
}

</script>

 

 

 

 

Top