i am having a problem closing a window in javascript.
first when a user clicks a button i dynamically create a window, but i want to add a button on the newly created window so when a user clicks the button it will close the new window.
for example
Code:
/*creates a new window */
newWin = window.open("","", "toolbar=yes,width=650,height=600,resizable=yes");
newWin.document.write( /*html code goes here */ );
so i want to create a button on newWin object so when a users clicks it, it will close.
i've tried
Code:
/*creates a button */
newWin.document.write("<input type='button' value='Close'>");
if(newWin.document.captureEvents(Event.Onclick)) {
newWin.close();
}
but that doesn't work, is there way to add listeners in javascript so when a user clicks a button it will close.
thanks for you help
djgerbavor3