Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Opening New Windows/Tabs (http://www.velocityreviews.com/forums/t928251-opening-new-windows-tabs.html)

d4rkn1ght 11-18-2006 10:18 PM

Opening New Windows/Tabs
 
Hello!

How can I make this script I generated with HomeSite, open links in new
windows/tab instead of the same?


<script language="JavaScript" type="text/javascript">
<!--
// original code by Bill Trefzger 12/12/96
function go1(){
if
(document.selecter1.select1.options[document.selecter1.select1.selectedIndex
].value != "none") {
location =
document.selecter1.select1.options[document.selecter1.select1.selectedIndex]
..value
}
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
document.write('<form name="selecter1"><select name="select1" size=1>');
document.write('<option value=none>Test');
document.write('<option value=none>--------------------');
document.write('<option value="http://www.a.null">A');
document.write('<option value="http://www.b.null">B');
document.write('<option value="http://www.c.null">C');
document.write('<option value="http://www.d.null">D');
document.write('</select>');
document.write('<input type="button" value="Go" onclick="go1()">');
document.write('</form>');
// end hiding contents -->
</script>


I will like to keep this as simple as possible. I don't know anything about
JavaScript.


TIA


--
http://www.3macsandaprinter.uni.cc/



ASM 11-18-2006 11:42 PM

Re: Opening New Windows/Tabs
 
d4rkn1ght a écrit :
> Hello!
>
> How can I make this script I generated with HomeSite, open links in new
> windows/tab instead of the same?
>
>
> <script type="text/javascript">


var truc = false;

function go1(){
var S = document.selecter1.select1;
if(S && S.options[S.selectedIndex].value != "none") {
url = S.options[S.selectedIndex].value
if(!truc || truc.closed)
truc = window.open('','','width=700,height=550,resizable= 1');
truc.location = url;
truc.focus();
}
}

> </script>
> <script type="text/javascript">
> <!--
> document.write('<form name="selecter1"><select name="select1" size=1>');
> document.write('<option value=none>Test');
> document.write('<option value=none>--------------------');
> document.write('<option value="http://www.a.null">A');
> document.write('<option value="http://www.b.null">B');
> document.write('<option value="http://www.c.null">C');
> document.write('<option value="http://www.d.null">D');
> document.write('</select>');
> document.write('<input type="button" value="Go" onclick="go1()">');
> document.write('</form>');
> // end hiding contents -->
> </script>




--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date

d4rkn1ght 11-19-2006 01:20 AM

Re: Opening New Windows/Tabs
 
in article 455f9a5d$0$25935$ba4acef3@news.orange.fr, ASM at
stephanemoriaux.NoAdmin@wanadoo.fr.invalid wrote on 11/18/06 6:42 PM:

> d4rkn1ght a écrit :
>> Hello!
>>
>> How can I make this script I generated with HomeSite, open links in new
>> windows/tab instead of the same?
>>
>>
>> <script type="text/javascript">

>
> var truc = false;
>
> function go1(){
> var S = document.selecter1.select1;
> if(S && S.options[S.selectedIndex].value != "none") {
> url = S.options[S.selectedIndex].value
> if(!truc || truc.closed)
> truc = window.open('','','width=700,height=550,resizable= 1');
> truc.location = url;
> truc.focus();
> }
> }
>
>> </script>
>> <script type="text/javascript">
>> <!--
>> document.write('<form name="selecter1"><select name="select1" size=1>');
>> document.write('<option value=none>Test');
>> document.write('<option value=none>--------------------');
>> document.write('<option value="http://www.a.null">A');
>> document.write('<option value="http://www.b.null">B');
>> document.write('<option value="http://www.c.null">C');
>> document.write('<option value="http://www.d.null">D');
>> document.write('</select>');
>> document.write('<input type="button" value="Go" onclick="go1()">');
>> document.write('</form>');
>> // end hiding contents -->
>> </script>

>
>


Hey thanks!

But I was looking for a new browser window/tab not a pop-up window.
Something more like the (target="_blank") in regular links.

Can that be possible?


TIA


--
http://www.3macsandaprinter.uni.cc/



ASM 11-19-2006 01:39 AM

Re: Opening New Windows/Tabs
 
d4rkn1ght a écrit :
>
> Something more like the (target="_blank") in regular links.


<script type="text/javascript">
function go1(){
var f = document.selecter1;
var s = f.select1;
var k = s.selectedIndex;
if(k>1) {
f.action=s.options[k].value;
f.submit();
}
}
</script>
<script type="text/javascript">
<!--
document.write('<form name="selecter1" action="" target="_blank">'+
'<select name="select1" size=1>');
document.write('<option value=none>Test');
document.write('<option value=none>--------------------');
document.write('<option value="test.htm">A');
document.write('<option value="test_1.htm">B');
document.write('<option value="http://www.c.null">C');
document.write('<option value="http://www.d.null">D');
document.write('<\/select>');
document.write('<input type="button" value="Go" onclick="go1()">');
document.write('<\/form>');
// end hiding contents -->
</script>


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date

d4rkn1ght 11-19-2006 03:44 AM

Re: Opening New Windows/Tabs
 
in article 455fb5b7$0$5076$ba4acef3@news.orange.fr, ASM at
stephanemoriaux.NoAdmin@wanadoo.fr.invalid wrote on 11/18/06 8:39 PM:

> d4rkn1ght a écrit :
>>
>> Something more like the (target="_blank") in regular links.

>
> <script type="text/javascript">
> function go1(){
> var f = document.selecter1;
> var s = f.select1;
> var k = s.selectedIndex;
> if(k>1) {
> f.action=s.options[k].value;
> f.submit();
> }
> }
> </script>
> <script type="text/javascript">
> <!--
> document.write('<form name="selecter1" action="" target="_blank">'+
> '<select name="select1" size=1>');
> document.write('<option value=none>Test');
> document.write('<option value=none>--------------------');
> document.write('<option value="test.htm">A');
> document.write('<option value="test_1.htm">B');
> document.write('<option value="http://www.c.null">C');
> document.write('<option value="http://www.d.null">D');
> document.write('<\/select>');
> document.write('<input type="button" value="Go" onclick="go1()">');
> document.write('<\/form>');
> // end hiding contents -->
> </script>
>


It works! Thank you very much!


--
http://www.3macsandaprinter.uni.cc/




All times are GMT. The time now is 09:14 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.