Solved

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

Posted on 2004-04-17
6
293 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 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
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!

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Glitching Slide Show 19 28
Boolean 13 24
ExcelWebAddIn Connect to SQL database (Javascript or VB.net) 7 28
Make Float not to Wrap 15 32
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

726 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