?
Solved

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

Posted on 2004-04-17
6
Medium Priority
?
302 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
[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
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 2000 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Suggested Courses

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