Solved

Pop up appears on absolute position on page

Posted on 2012-12-22
3
222 Views
Last Modified: 2012-12-24
Hi all,

I have a pop up and I want it to appear about 1/3 of the page down and to the left of the screen. Could someone give me an example of how to change the code to do this and I will then be able to play around with the exact coordinates. Here is the code for it that I need to alter:

<a href="#" onclick="Popup=window.open('http://www.r.com/module/r/template/default/controller/enq/questionpopup.php','Popup','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, width=715,height=150,left=430,top=23'); return false;">

Open in new window

0
Comment
Question by:TLN_CANADA
[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
  • 2
3 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 38716907
just play with the the left,top calculations to get exactly the position you want:


<a href="javascript:void(0);" onclick="PositionPopup('http://www.r.com/module/r/template/default/controller/enq/questionpopup.php', 'Popup',715,150); return false;">

 <script type="text/javascript">
							  function PositionPopup(pageURL, title,w,h) {
var left = (screen.width/6)-(w/6);
var top = (screen.height/6*5)-(h/6*5);
var targetWin = window.open (pageURL, title, 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
								  </script>

Open in new window

0
 

Author Comment

by:TLN_CANADA
ID: 38717496
Thanks! That's working perfectly now. One other small question about this if I may.

I have no different pop ups on the page that I want the user to be able to use both or separately as they wish.

Here is the code for the new popups:

			<a href="#" onclick="Popup=window.open('http://www.xxxx.com/','Popup','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, width=600,height=490,left='+(screen.width-600)+',top=0'); return false;"><img src="res/imer.png"></a>
			
			<a href="javascript:void(0);" onclick="PositionPopup('http://www.xxdfdx.com/module/x/template/default/controller/enq/questionpopup.php', 'Popup',715,150); return false;"><img src="res/generate_question.png"></a>

Open in new window


At the moment when I open both pop ups the second one overrides the first one but I want them to appear in separate popup windows.

Thanks for your help,

Derek
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 38718025
you have to use unique name for each popup to prevent overriding (since both windows called 'Popup')
0

Featured Post

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.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Find out what you should include to make the best professional email signature for your organization.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

728 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