Solved

avoing overriding pop up windows

Posted on 2011-09-16
8
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: 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.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

749 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