Open centre screen

  • lomilmand
  • Student
  • Student
  • No Avatar
  • Joined: Jun 07, 2004
  • Posts: 91
  • Loc: Bournemouth, UK
  • Status: Offline

Post July 31st, 2004, 2:15 pm

Anyone know how to adapt this code so that the new window open in the centre of the screen? Thanks for any help or advice :wink:

Code: [ Select ]
<script type="text/javascript">
<!--

var newwindow;
function musicopen(url)
{
newwindow=window.open(url,'name','height=50,width=320');
if (window.focus) {newwindow.focus()}
}
// -->
</script>
  1. <script type="text/javascript">
  2. <!--
  3. var newwindow;
  4. function musicopen(url)
  5. {
  6. newwindow=window.open(url,'name','height=50,width=320');
  7. if (window.focus) {newwindow.focus()}
  8. }
  9. // -->
  10. </script>
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 31st, 2004, 2:15 pm

  • s15199d
  • Expert
  • Expert
  • User avatar
  • Joined: Feb 20, 2004
  • Posts: 524
  • Loc: NC, USA
  • Status: Offline

Post August 2nd, 2004, 8:14 am

the new window has a top and left properties
you can set them to center your image...but it will only be exactly centered on whatever resolution u choose to set the top & left values for
Image
Give a man a fish he eats for a day. Teach a man to fish he eats for a lifetime.
  • Vladdrac
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Feb 04, 2004
  • Posts: 2136
  • Loc: Louisville, Ky
  • Status: Offline

Post August 2nd, 2004, 11:34 am

you couldn't set a percentage value for the top and left values i wonder?
  • s15199d
  • Expert
  • Expert
  • User avatar
  • Joined: Feb 20, 2004
  • Posts: 524
  • Loc: NC, USA
  • Status: Offline

Post August 3rd, 2004, 11:06 am

<<<<<<wasn't thinking...percentages...yea...duh...that'd work
Image
Give a man a fish he eats for a day. Teach a man to fish he eats for a lifetime.
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post August 3rd, 2004, 11:38 am

well, it wouldn't cos 50% (for eg) would put the top left corner in the middle. You can't use percentages to get the center of a pop-up into the center of the screen for <b>every</b> res.....

Try
Code: [ Select ]
var popWidth  = 320;
var popHeight = 50;
var popLeft  = (screen.width - popWidth) /2;
var popTop   = (screen.height - popHeight) /2;
  1. var popWidth  = 320;
  2. var popHeight = 50;
  3. var popLeft  = (screen.width - popWidth) /2;
  4. var popTop   = (screen.height - popHeight) /2;
CSS website design tutorials

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 263 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.