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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    JS - open another window

    Hello

    I am using this to open a new window from a link on a Web page:

    <Script Language="JavaScript">

    function load() {
    var load = window.open('LAN1.htm','','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,l ocation=no,status=no');
    }

    </Script>

    In the body I have:

    <p><b>Watch the video <a href="javascript:load()">here</a></b></p>

    Now I would like to open a window to LAN2 from another link on the same Web page.

    In other words, I will have two links on the one Web page opening up windows to LAN1.htm and another link to LAN2.htm.

    How would I do that?

    Thanks.

    Steve

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    I would do:
    Code:
    function load(url) {
    var load = window.open(url,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,l ocation=no,status=no');
    }
    and then
    Code:
    <p><b>Watch the video <a href="javascript:load('LAN1.htm')">here</a></b></p>
    Untested, but that's the basic idea. Put the URL (enclosed in quotes) inside the parentheses when you call the function
    Last edited by binaryWeapon; 06-13-2008 at 06:34 PM. Reason: extra code tag

  • Users who have thanked binaryWeapon for this post:

    SteveH (06-13-2008)

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello binary

    Yes, this in the <HEAD> tags:

    function load(url) {
    var load = window.open(url,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,l ocation=no,status=no');
    }

    and the following in the <BODY> tags:

    Watch the video <a href="javascript:load('LAN1.htm')">here</a>

    Watch the video <a href="javascript:load('LAV2.htm')">here</a>

    And it works a treat!

    Very many thanks for your quick and useful help.

    Cheers

    Steve


  •  

    Posting Permissions

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