Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

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

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
indyng
Asked:
indyng
1 Solution
 
devicCommented:
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
 
indyngAuthor Commented:
devic

It's not working.
0
 
ZvonkoSystems architectCommented:
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
Industry Leaders: 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!

 
ZvonkoSystems architectCommented:
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
 
john-at-7fffCommented:
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
 
john-at-7fffCommented:
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

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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now