PDA

View Full Version : Opening New Window Through Links



lschena
08-17-2011, 12:54 PM
Hello,

This is a simple script in which a users selects from a drop down menu a choice which links to a URL.
Could anyone tell me what and where to put code that tells each choice/url to open a new window??

Thank you in advance!

[CODE]
<form name="Coffee">
<p><select name="info" size="1">
<option value="http://www.saeco-usa.com/">Saeco Vienna Plus</option>
<option value="http://www.rancilio.it/rancilio/index.jsp">Rancilio Silvia</option>
<option value="http://www.gaggia.com/index.asp">Gaggia Titanium</option>
</select></p>

<script language="javascript">
//This "function" described as go is what makes this work

function go()
{
location=document.Coffee.info.
options[document.Coffee.info.selectedIndex].value
}

</script>

<input type="button" name="test" value="Go!" onClick="go()">

</form>
[CODE]

Minos
08-17-2011, 01:25 PM
it should work if you change this


location=document.Coffee.info.
options[document.Coffee.info.selectedIndex].value

to this


window.open(document.Coffee.info.options[document.Coffee.info.selectedIndex].value)

I think. Let me know if it helps.

lschena
08-17-2011, 04:53 PM
Yes - that did it! Thank you so much for the info!!