Results 1 to 3 of 3

Thread: help with positioning

  1. #1
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with positioning

    1) DHTML Window:

    2) http://www.dynamicdrive.com/dynamici...htmlwindow.htm

    3) Describe problem: Script works great but how do I get the popup
    window to popup in a specific location instead of in the upper left hand
    corner. I am using it to popup answers to FAQs and would like it to popup under the FAQ that is clicked on.

    Thanks for your help.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This is where that is determined:

    Code:
    function loadwindow(url,width,height){
    if (!ie5&&!ns6)
    window.open(url,"","width=width,height=height,scrollbars=1")
    else{
    document.getElementById("dwindow").style.display=''
    document.getElementById("dwindow").style.width=initialwidth=width+"px"
    document.getElementById("dwindow").style.height=initialheight=height+"px"
    document.getElementById("dwindow").style.left="30px"
    document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
    document.getElementById("cframe").src=url
    }
    }
    Change the colored numbers. 30 from the left and 30 (two places in the above) from the top are the 'default'. You could also do this:

    Code:
    function loadwindow(url,width,height,wleft,wtop){
    if (!ie5&&!ns6)
    window.open(url,"","width=width,height=height,scrollbars=1")
    else{
    document.getElementById("dwindow").style.display=''
    document.getElementById("dwindow").style.width=initialwidth=width+"px"
    document.getElementById("dwindow").style.height=initialheight=height+"px"
    document.getElementById("dwindow").style.left=wleft+"px"
    document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+wtop+"px" : iecompattest().scrollTop*1+wtop+"px"
    document.getElementById("cframe").src=url
    }
    }
    Now you can specify in the calls, ex:

    Code:
    <a href="javascript:loadwindow('http://www.google.com',600,400,50,100)">Geocities</a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It worked great.

    Thanks ever so much for the help!

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
  •