WEB Noob Questions about links and new windows.

Discussion in 'OT Technology' started by CrazyFoool, Oct 24, 2007.

  1. CrazyFoool

    CrazyFoool OT Supporter

    Joined:
    Nov 7, 2002
    Messages:
    43,974
    Likes Received:
    9
    Location:
    Issaquah
    Ok so I have a phpbb and also a free chatroom thing.

    I want to have a link on my boards page that opens up a new window in the correct size of my chat.

    what code do I have to use to make that happen?
     
  2. GotVtec

    GotVtec 8th World Wonder

    Joined:
    Mar 14, 2000
    Messages:
    575
    Likes Received:
    0
    Location:
    Omaha, NE
    JavaScript is the way you want to handle this.

    in the <head> of your pages add:

    Code:
    <script type="text/javascript">
    // <![CDATA[
    function pop_window(page,name,w,h,scroll) {
    
    var LeftPosition = (screen.width) ? (screen.width-w)/2 : 100;
    var TopPosition = (screen.height) ? (screen.height-h)/2 : 100;
    var settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
    var page;
    
    window.open(page,name,settings);
    }
    // ]]>
    </script>
    
    Then, in your page, in the <a> tag for the link to the chat program, change the <a> tag to this:

    Code:
    <a href="/linkto/chat.php" onclick="pop_window(this.href, 'Window Name','775','575','yes');return false" onfocus="this.blur()">Click here to chat!</a>
    
    The 775 and 575 in there equal the width and height. The yes means the window can be resizable.

    This is should work if you have any javascript libraries installed too.
     
  3. CrazyFoool

    CrazyFoool OT Supporter

    Joined:
    Nov 7, 2002
    Messages:
    43,974
    Likes Received:
    9
    Location:
    Issaquah
    Sweet thanks a lot =)
     
  4. CrazyFoool

    CrazyFoool OT Supporter

    Joined:
    Nov 7, 2002
    Messages:
    43,974
    Likes Received:
    9
    Location:
    Issaquah
    Is there a freeware chat script thing that you recommend? the one i use blows haha.


    hmm...also, i tested out your code but it doesn't seem to be popping a new window open.


    http://www.premierfantasysportsleague.com

    dont mind the emptiness hahaha.
     
  5. ez4me2c3d

    ez4me2c3d Cold Member

    Joined:
    Sep 19, 2003
    Messages:
    1,836
    Likes Received:
    0
    Location:
    Minneapolis, MN
    You're missing a key component.... the Javascript function pop_window!

    You see the first section of code GotVtec posted? with <script in it? You need that in your head section of that page.
     
  6. CrazyFoool

    CrazyFoool OT Supporter

    Joined:
    Nov 7, 2002
    Messages:
    43,974
    Likes Received:
    9
    Location:
    Issaquah

    I placed it in my main index.html page...it didn't work, so i took it out. ill put it back..

    is that waht you mean?


    edit: see? i put it back in..and it still doesn't pop up.

    do i need to edit that first box of codes at all?
    I know i have to edit the 2nd one for my url.
     
    Last edited: Oct 24, 2007

Share This Page