...

View Full Version : JS - open another window



SteveH
06-13-2008, 06:15 PM
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

binaryWeapon
06-13-2008, 07:34 PM
I would do:

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

<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

SteveH
06-13-2008, 07:51 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum