|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
button to open a window and a button to close that window
I'm trying to open a new window by clicking a button on the "opener" page and then close that recently opened window with another button on the "opener" page.
I have the code to open the window: Code:
<script language="JavaScript">
<!--
function openwindow() {
NewWin=window.open("",'mypopup','resizeable=yes,toolbar=no,status=no,sc rollbars=yes,width=400,height=400');
NewWin.location.href = "mypage.html";
}
//-->
</script>
|
|
#2
|
||||
|
||||
|
you can't close it from the opener page, because the opener page no longer has the focus...it would have to be closed from the open window itself.
|
|
#3
|
||||
|
||||
|
so I guess that's why NewWin.close(); didn't work? This just seems like something javascript could do. The newly opened window can control the opener but the opener can't control the new window? Bummer.
|
|
#4
|
||||
|
||||
|
when the new window opens the other one loses focus...that's why it won't work.
the active window has precedence. |
|
#5
|
||||
|
||||
|
say you click on the opener window giving it focus...
|
|
#6
|
||||
|
||||
|
won't do anything...
The window can be opened by another page, but can only be closed by itself. |
|
#7
|
|||
|
|||
|
Quote:
U can close the window from any page using the Handler. mywin=window.open(URL,window name,parameters); To close the window use the handler or window name which u are using. In above code it is mywin. if (mywin) mywin.focus(); Thanks FMBBC |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > button to open a window and a button to close that window |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|