Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: New window help

  1. #1
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    New window help

    Hi

    I really want to be able to open up a new window when a link is clicked on.

    However I would like the window to be centered [not required] and be the size of the contents within it.

    Is this possible?

    Thanks

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    India
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this:
    Code:
    <!doctype html public "-//W3C//DTD HTML 4.01 Strict//EN"
    	"http://www.w3c.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Center Window</title>
    <script language="JavaScript1.2">
    function centerWindow(mySizeX, mySizeY, url)
    {
    	// Make sure the screen height and width are greater than the window's height and width
    	var top = (screen.height > mySizeY) ? (screen.height - mySizeY) / 2 : 0;
    	var left = (screen.width > mySizeX) ? (screen.width - mySizeX) / 2 : 0;
    
    	window.open(url, "_blank", "screenX=" + left + ",screenY=" + top + ",width=" + mySizeX + ",height=" + mySizeY);
    }
    </script>
    </head>
    
    <body>
    <a href="javascript:centerWindow(500, 500, 'http://microsoft.com/')">Test</a>
    </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does that make the window 500 x 500?

    If it does I don't want that - I want the window to be the same size as the contents within it.

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    What size is the content within it?

  • #5
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry if I came across as rude - I'm a little *yawns* tired

    Well, to be honest, the size will vary.

    I'm hoping someone can help me and I'm surprised no-one has thought of this or used it lol o.O

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Location
    India
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What would "same size as the contents" mean? A window of any size could fit all the contents. Do u mean to say that you dont want any scroll bars but still be able to see the entire contents in the window?

  • #7
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In a way yes - I dont want a scrollbar or a toolbar or anything but that's not the problem.

    For example, say the contents take up half of the screen, the window will also be half a screen long with no excess spaces.

    If you're still not sure, I'll happily provide a sceencap.


    Many Thanks

  • #8
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Can't you do the site the way 99.999% of other people do it, by making the content fit the window? Don't think I'd like a pop-up resizing itself with every page loaded in it...

    You better show what you mean, coz it looks like you're confusing a lot of ppl

  • #9
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nightfire :

    lol I thought I was O:-).

    This is what I'd like it too look like.


    The size will not change considerably, but it's just a design factor and I thought they'd look better in their own window.

    This is what I don't want to look like:

    Raaah

    Obviously it won't have the staus bar, it'll be just like in the previous screenshot.

    Hope that's clarified it a bit!


    Cheers

  • #10
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *bump*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •