Solved

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

Posted on 2004-04-17
6
282 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
radio button value 3 45
populate dynamic drop down from a csv 3 38
Javascript generate change location 12 24
Problem to page 4 23
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

705 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

16 Experts available now in Live!

Get 1:1 Help Now