Solved

How do I add a MoveTo x y coordinates for this script?

Posted on 2004-04-17
6
284 Views
Last Modified: 2012-06-27
Hi Experts,

I want to move the  pop up window to the far right

function popuponclick()
{
  w1 = window.open("http://www.myweb.com/mypage.html", "mywindow","status=1,width=165,height=700");
}

THANKS
0
Comment
Question by:indyng
6 Comments
 
LVL 25

Expert Comment

by:devic
ID: 10849198
hi indyng,
try this:
=============
function popuponclick()
{
      var w1 = window.open("about:blank", "mywindow","status=1,width=165,height=700");
      w1.moveTo(screen.width-165,0)
}
0
 
LVL 1

Author Comment

by:indyng
ID: 10849222
devic

It's not working.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 10849224
Or like this:

function popuponclick()
{
  w1 = window.open("http://www.myweb.com/mypage.html", "mywindow","left="+(screen.width-165)+"status=1,width=165,height=700");
}

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 63

Expert Comment

by:Zvonko
ID: 10849230
Or like this:

function popuponclick()
{
  w1 = window.open("http://www.myweb.com/mypage.html", "mywindow","top=0,left="+(screen.width-165)+",status=1,width=165,height=700");
  w1.focus();
}

0
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10849232
I would do it like this (this is a bit different from your starting point). The reason is that this gets tricky for different browsers.

<script>
function launchCenter(url, name, height, width) {
      var str = "height=" + height + ",innerHeight=" + height;
      str += ",width=" + width + ",innerWidth=" + width;
      if (window.screen) {
            var ah = screen.availHeight - 30;
            var aw = screen.availWidth - 10;
            var xc = aw - width;
            str += ",left=" + xc + ",screenX=" + xc;
      }
      return window.open(url, name, str);
}

var win = launchCenter('http://www.yahoo.com', 'right', 220, 440);
</script>

0
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10849237
So to have your original function name, it would be like this:

<script>
function launchCenter(url, name, height, width) {
      var str = "height=" + height + ",innerHeight=" + height;
      str += ",width=" + width + ",innerWidth=" + width;
      if (window.screen) {
            var ah = screen.availHeight - 30;
            var aw = screen.availWidth - 10;
            var xc = aw - width;
            str += ",left=" + xc + ",screenX=" + xc;
      }
      return window.open(url, name, str);
}

function popuponclick() {
launchCenter("http://www.myweb.com/mypage.html", "mywindow", 165, 700);
}
</script>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now