Click to See Complete Forum and Search --> : Opening Java script links in a new window from a framed web page


Electrode
October 7th, 1999, 04:47 PM
hello, I am using this script in a framed web page,

<TITLE>make a choice</TITLE>

<SCRIPT LANGUAGE="JavaScript">

</SCRIPT>

<CENTER><FORM NAME="links">
<SELECT>
<OPTION VALUE="no link">Make a choice
<OPTION VALUE="http://www.htmlgoodies.com">HTMLgoodies
</SELECT>
<INPUT TYPE="button" VALUE="Go!"
onClick="menu(this.form.elements[0])">
</FORM></CENTER>

HTML programming lets you use Target="_top" with a url in an
AHREF command to open the url or link in a new window, I have
tried using the target command in a number of places within the
script and option commands no luck, what do I need to do to get
the selected option url to open in it's own window? Currently the
script opens the link in the window where the script is located.
Any help would be greatly appreciated.

unicman
October 7th, 1999, 05:27 PM
U can try using 'document.open' method. It creates new browser window, and then give it the url u want.

- UnicMan
http://members.tripod.com/unicman

Electrode
October 7th, 1999, 06:03 PM
thanks for the command UnicMan, but I am new to java scripting and need to know where to place the command and the syntax associated to it to make it work

unicman
October 10th, 1999, 12:29 PM
I have some code that will help u...

function DoProperties()
{
var iHeight=250;
var iWidth=300;
var iTop=0;
var iLeft=0;
var sUrl='';

iTop=SetWindowTopPosition(iHeight)-10;
iLeft=SetWindowLeftPosition(iWidth);
if (window.navigator.appName=="Microsoft Internet Explorer")
{
var out = window.open(
"test.asp",
"",
"top=" + iTop + ",left="+ iLeft + ",width=" + iWidth + ",height=" + iHeight +
",resizable=0,scrollbars=no"
);
}
else if (window.navigator.appName=="Netscape")
{
var out = window.open(
"test.asp",
"",
"screenY=" + iTop + ",screenX=" + iLeft +",width=" + iWidth + ",height=" + iHeight +
",resizable=0,scrollbars=no"
);
}
}

- UnicMan
http://members.tripod.com/unicman