简体   繁体   中英

How to open two separate pop-up windows on click of two separate links?

I have below a javascript function which gets called on click of two separate links provided on a jsp file.

In brief, this functions opens a new popup window. What I want is when I click these two links two new pop up window should open.

But whats happening is this; I click on one link, it opens a new popup window but now I click on second link, it does not open the new popup window instead it is refreshing the old pop-up window (which opened on click of link1) with this link details.

I am not getting how to open two separate pop ups?

function showHelp(orgType) {
var pageLoc = '<%=helpURL%>bin/view/Main/?appSession=<%=request.getSession().getId()%  >&securityToken=<%=appUtility.getSecurityToken(session
   .getId(), login, custId)%>&appurl=<%=java.net.URLEncoder.encode((new java.net.URL(request.getScheme(),ip,request.getServerPort(), "")).toString() + request.getContextPath(), "ISO-8859-1")%>&custType='+custType+'&custName=<%=hostName%>';
 self.open (pageLoc,'ServicePopUp','height=600,width=800,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes'); 

}

You would need to provide a different name for each of the windows to differentiate them from each other:

function showHelp(orgType, windowName) {
    ...
    self.open (pageLoc, windowName,'height=600,width=800,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes');
}

See the extra parameter and where it fits into the open function? You'd need to provide 2 different names for the two links. Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM