Hello all!
I have 3 different links on my main page (main.asp) - X,Y,Z.
Link X opens x.asp ,
Y opens y.asp,
Z opens z.asp
When clicking on X, x.asp opens in a pop up.
When I click again on X, the focus will come to the same pop up (working as expected).
But without closing the already opened pop up, if I click on Y, the already opened window opens up, showing x.asp
I want the already opened window to refresh and show y.asp when Y is clicked. Also I don't want to open separate pop ups for X,Y and Z. Only a single pop up window should be opened when any link is clicked.
My code is as below :
**** Javascript function *************
var mywin = null;
function popUp(winObj,mypage, myname, w, h)
{
var winl = (screen.width - w);
var wint = (screen.height - h);
if (winObj != null)
{
if (!winObj.closed)
{
winObj.focus();
return winObj;
}
}
winprops = 'height='+(screen.height - 195)+',width='+(screen.width - 10)+',top=0,left=0,scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes,status=yes';
win = window.open(mypage, myname, winprops);
win.focus();
return win;
}
*************************************
****calling the function **********
<a href="x.asp" onclick="javascript:mywin=popUp(mywin,this.href);return false" class="href_button"> X </a>
<a href="y.asp" onclick="javascript:mywin=popUp(mywin,this.href);return false" class="href_button"> Y </a>
<a href="z.asp" onclick="javascript:mywin=popUp(mywin,this.href);return false" class="href_button"> Z</a>
******************************************************
There is one more requirement :
The links X, Y and Z also exists in another page (another.asp) . If pop up from the main.asp is still open , say ,the pop up for X is still open, clicking on X in another.asp should automaticaly focus to the already opened window without refreshing the contents. In the same way if X is already open from main.asp and the link to Y is clicked from another.asp, the already opened window should be refreshed and load y.asp.
Please provide a solution which satisfies all the requirements described above to work correctly...Thanks in advance..