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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Calgary, AB
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do you open a new window?

    When a person enters your webpage, how do you make it so it automaticly opens a new window?

    Example:

    I got to www.dynamicdrive.com

    but when I get there a new window opens up advertising cutandpaste.


    How do I do this on my webpage?

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    On the fly:



    <A HREF="#null" ONCLICK="window.open('Your Page.htm', 'win1','width=300,height=100,left=450,top=250,toolbar=yes');return false">Your Link</A>



    Using a script:


    <script>
    function newWin(theURL)
    {
    var newWin=open((theURL),'','width=200,height=100,top=300,left=250' )
    }
    </script>

    <a href="javascript:newWin('yourpage.htm')">Link</a>


    You can use setTimeout method to open after set time or use onload

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    <body onload="window.open('popuppage.html')">

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    Calgary, AB
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is it possible to set a size for the window that opens?

  • #5
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    <body onload="window.open('Your Page.htm', 'win1','width=300,height=100,left=450,top=250,tool
    bar=yes')">

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Just change the width and height attributes to the size you want.

    Same with the position: left and top

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or if you want a new window with no bells or whistles...

    <a href="page.html" target="_blank">click here</a>

    redhead

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,649
    Thanks
    1
    Thanked 0 Times in 0 Posts
    <NOTE> Different resolutions will have your window opening in different locations on your page regardless of instructions. It's best to use a centering technique.</NOTE>
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">


  •  

    Posting Permissions

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