You are here: irt.org | FAQ | JavaScript | Sound | Q444 [ previous next ]
Try this:
<FORM NAME="myform"> <SELECT NAME="myselect"> <OPTION VALUE="afile1.wav">file 1 <OPTION VALUE="afile2.wav">file 2 <OPTION VALUE="afile3.wav">file 3 </SELECT> </FORM> <SCRIPT LANGUAGE="JavaScript"><!-- function mytune() { location.href = document.myform.myselect.options[document.myform.myselect.selectedIndex].value; } //--></SCRIPT> <A HREF="javascript:mytune()"><IMG SRC="apicture.gif" HEIGHT="100" WIDTH="100" BORDER="0"></A>
Or:
<FORM NAME="myform"> <SELECT NAME="myselect"> <OPTION VALUE="afile1.wav">file 1 <OPTION VALUE="afile2.wav">file 2 <OPTION VALUE="afile3.wav">file 3 </SELECT> </FORM> <A HREF="default.wav" onClick="this.href=document.myform.myselect.options[document.myform.myselect.selectedIndex].value"><IMG SRC="apicture.gif" HEIGHT="100" WIDTH="100" BORDER="0"></A>
I prefer the second one.