Solved

Pop up appears on absolute position on page

Posted on 2012-12-22
3
219 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

777 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