Advance Digital Studio 4 - Spring 2003

TARGETTING NEW windowS [with and without javascript]

The simplest way to open a new window from a link is to use the TARGET attribute of the ANCHOR tag:

load test.htm into new window named "testWin"
<a href="test.htm" target="testWin">test.htm</a>

load test01.htm into window named "testWin"
<a href="test.htm" target="testWin">test01.htm</a>

load test02.htm into window named "testWin"
<a href="test.htm" target="testWin">test02.htm</a>

JAVASCRIPT
a simple method: the javascript can be placed directly in the onclick method.

load test.htm into new window named "testWin1"
<a href="#" onclick="window.open('test.htm','testWin1','height=300,width=500,status'); return false;">test.htm</a>

load test01.htm into new window named "testWin1"
<a href="#" onclick="window.open('test01.htm','testWin1','height=300,width=500,status'); return false;">test01.htm</a>

load test02.htm into new window named "testWin1"
<a href="#" onclick="window.open('test02.htm','testWin1','height=300,width=500,status'); return false;">test02.htm</a>

Fully defined JavaScript pop-up window.
note: only those properties of the window that are defined will be included:

load test.htm into new window named "testWin2"
<a href="#" onclick="window.open('test02.htm','testWin1','height=300,width=500,resizable,status,location,scrollbars,menubar,toolbar,screenX=100,screenY=100,left=100,top=100'); return false;">test.htm</a>


note:
"screenX" and "screenY" apply only to Netscape 4+
"left" and "top" apply to IE
both control the same thing: where the new window appears



Advance Digital Studio 4 - Spring 2003