CodeToad Forums » ASP » Re: simple linking to exteranal site using dropdown and button example needed for newbie
|
|
|
Try this:
<select onchange="javascript:location.href=this.options[this.selectedIndex].value; return false;">
<option value=''>
Please Select a site</option>
<option value=`http://www.yahoo.com`>Yahoo</option>
<option value=`http://www.msn.com`>Msn</option>
</select>
David
|
|
|
The above code is good, but this one is a great one too.
<Script Language="JavaScript">
<!-- Hide the script from old browsers --
function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}//--> </SCRIPT>
<FORM NAME="form1">
<SELECT NAME="select" ONCHANGE="goto(this.form)" SIZE="1">
<OPTION>Your Menu Title
<OPTION VALUE="/index.html">CodeToad
<OPTION VALUE="/demos/shopping_cart/index.html">CodeToad Shopping Cart
<OPTION VALUE="www.codetoad.com/demos/blog">CodeTOad Blog</SELECT>
</FORM>
Add as many option values you need!!!
DaMoe
Edited by Forum Admin at 05:47 on Sunday, July 06, 2003 Reason: links changed - sorry!]
|
|
|
|
|
|
|
|