Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  3] [ 1]  / answers: 1 / hits: 41814  / 12 Years ago, tue, july 10, 2012, 12:00:00

I want to open a window on click, but I want to open it behind the current window, or when the new window opens it should minimize itself. I have made a function but it actually did not work.



<head>
<meta http-equiv=Content-Type content=text/html; charset=utf-8 />
<title>Untitled Document</title>
<script type=text/javascript>
function wn(){
var mm=window.open('http://www.google.com','newwindow','width=200, height=200', _blank);
}
</script>
</head>
<body>
<a href=# onclick=wn()>click</a>
</body>

More From » jquery

 Answers
23

EDIT



Parent window HTML



<script language=JavaScript type=text/javascript>
function openPopUP() {
window.open('mywindow.html','NewWin',
'toolbar=no,status=no,width=350,height=135')
}
</script>

<body onLoad=openPopUP();>
or
<a href=javascript:openPopUP();>Click to open popup</a>


Child Window i.e PopUp Window File



The below script should be in the child window. The child window will open and will automatically be hidden after 1 second. The value 1000 specified in the setTimeout method is the duration in milliseconds for which the child window will be open. You can increase this timeout duration if you want the child window to be open longer.



<body onLoad=setTimeout('window.blur()', 1000); 
onFocus=setTimeout('window.blur()', 1000);>





This might work for you: Add this line of code in the onload event of your child window...



window.parent.opener.focus(); 

[#84364] Sunday, July 8, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
timothyc

Total Points: 233
Total Questions: 103
Total Answers: 103

Location: Jordan
Member since Thu, Aug 5, 2021
3 Years ago
;