Closed Thread
Results 1 to 5 of 5

Thread: [Javascript] Small bug somewhere

  1. #1
    W as in Whisky Wojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to behold Wojtek's Avatar
    Join Date
    Nov 2000
    Location
    Montreal, Canada
    Posts
    6,275

    [Javascript] Small bug somewhere

    The javascript code:
    PHP Code:
    <script language=Javascript>
    function 
    popUp(URL) {
    day = new Date();
    id day.getTime();
    eval(
    "page" id " = window.open(URL, '" id "', 'toolbar=0,scrollbars=0,location=0,
    statusbar=0,menubar=0,resizable=0,width=300,height=500,
    left=((screen.width/2)-150),top=((screen.height/2)-250)');"
    );
    }
    </script> 
    What I've done here is replaced fixed size values for left and top wich I used on my 1024x768 resolution to make the pop centered. However, when I did the screen/2 method, it pops in the upper left corner, not centered.

    Any ideas why?

    Thanks
    -W

  2. #2
    Junior Member DBers is an unknown quantity at this point
    Join Date
    Feb 2004
    Location
    NJ, USA
    Posts
    11
    I'm not that into JavaScript as of late. but this works for me:

    [code]
    <script language=Javascript>
    function popUp(URL)
    {
    day = new Date();
    id = day.getTime();
    w = 300;
    h = 500;
    l = (screen.width/2) - (w/2);
    t = (screen.height/2) - (h/2);
    window.open(URL,id,"toolbar=0,scrollbars=0,location=0,status bar=0,menubar=0,resizable=0,width=" + w + ",height="+ h + ",left=" + l + "top="+ t);
    }
    </script>
    [code]

  3. #3
    W as in Whisky Wojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to behold Wojtek's Avatar
    Join Date
    Nov 2000
    Location
    Montreal, Canada
    Posts
    6,275
    that code gives me a javascript error
    -W

  4. #4
    Junior Member DBers is an unknown quantity at this point
    Join Date
    Feb 2004
    Location
    NJ, USA
    Posts
    11
    when you copy and paste, make sure that there are no breaks in the window function.

    goto resiza and press delete, pring the line below it up

    for some reason the boards ads a break line at the end of each line when posting

  5. #5
    W as in Whisky Wojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to beholdWojtek is a splendid one to behold Wojtek's Avatar
    Join Date
    Nov 2000
    Location
    Montreal, Canada
    Posts
    6,275
    Excellent

    Works perfectly!

    Thanks
    -W

Closed Thread

Bookmarks

Posting Permissions

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