Solved

avoing overriding pop up windows

Posted on 2011-09-16
8
225 Views
Last Modified: 2012-06-21
Hi,
  I have a first pop up window in javascript and from first popup window, I need to open second popup window. When I open second popup window, it is overriding first pop up window.
 I don't want to override first popup window. Please let me know how can I do it.

Thank you
0
Comment
Question by:Sthokala
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36550935
check this simple example, it works for me here
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
</HEAD>

<BODY>
	<a href="javascript:window.open(location.href)">Open window</a>
</BODY>
</HTML>

Open in new window

0
 

Author Comment

by:Sthokala
ID: 36551112
Hi Gurvinder,
  Thank you for your reply. I want to open a popup from another popup.

Thank you
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36551117
please share that code which is not working for you
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Sthokala
ID: 36551324
Please find the attached code.

Thank you
a.jsp has code like below
function showLogin(){
var adjustHeight = 40;
	  var adjustWidth = 15;
	        var height = screen.availHeight-adjustHeight;
	        var width = screen.availWidth-adjustWidth;        
	        var winProps = "height="+height+",width="+width+",left=0,top=0,resizable=yes,scrollbars=yes";        
	var strURL = "login.jsp";
	var win = window.open(strURL,"login",winProps);
	win.focus();
	
}

Login.jsp has code like beow

function postLogin(){
	var adjustHeight = 40;
	  var adjustWidth = 15;
	        var height = screen.availHeight-adjustHeight;
	        var width = screen.availWidth-adjustWidth;        
	        var winProps = "height="+height+",width="+width+",left=0,top=0,resizable=yes,scrollbars=yes";        
	        var userName = document.getElementById("userName").value;
	        var password = document.getElementById("password").value;
	        var strURL = "loginbean.jsp?userName=" + userName+"&password="+password+"&loginType="+"cpoeLogin";
		var winPop = window.open(strURL,"theWin",winProps);
		
		
	}

Open in new window

0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 36551553
on line 25, try changing:

var winPop = window.open(strURL,"theWin",winProps);

to:
var winPop = window.open(strURL,"_blank",winProps);

OR
var winPop = window.open(strURL,undefined,winProps);
0
 
LVL 18

Expert Comment

by:nap0leon
ID: 36551570
/agree with hielo
If you explicitly tell the code the name of the window you are popping, the new stuff will go to that window.

using "_blank" normally works.

If you encounter issues with _blank, use a random number generator and pass window.open the random number as the name.
0
 

Author Comment

by:Sthokala
ID: 36551695
Thank you..exactly what I wanted.
0
 
LVL 82

Expert Comment

by:hielo
ID: 36551702
>>exactly what I wanted.
Did both work as expected across browsers? Just curious.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question