|
Post by meerkat on Dec 4, 2020 7:13:30 GMT -5
I have a simple web app that opens a popup window. Simple enough.. I can open the popup window. How do I close it under program control?
The javascript function allows the popup to open
function popitup(url) { newwindow=window.open(url,'name','height=600,width=800,top=200,left=200'); if (window.focus) {newwindow.focus()} return false; }
I can open a popup with a link that works
<a href='pop' target='pop' onclick="return popitup('http://www.google.com')"> Open Popup</a>
I can close the popup with the following link
<a id='clos' name='clos' href='javascript:if (newwindow) newwindow.close()'>Close</a>
I know the id='clos' and name='clos' works because I can reference it with a button and it closes the popup. <P><input type='button' value='closeIt' onclick=document.getElementById('clos').click();>
I'd like to close it under program control.. My question .. Why doesn't this javascript work?? Far as I know it should be doing the same thing as the button above?
document.getElementById('clos').click();
Thanks for the help.. Dan
|
|
|
Post by meerkat on Dec 5, 2020 3:09:05 GMT -5
Problem solved.
Instead of trying to create the popup with buttons or href, I decided to create the popups directly with the following javascript:
var x=popitup('http://google.com');
Thanks for the help.. Dan
|
|