Solved

avoing overriding pop up windows

Posted on 2011-09-16
8
228 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

729 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