Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


JavaScript Programming

JavaScript > Code Examples

1-Click Easy Drop-Down Menues

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
1-Click Easy Drop-Down Menues <!-- Instructions: Set theTarget variable value in the script, as noted. Set the title, addresses, and items in the form, as shown. Insert this entire block of code -- both the script and the form -- in your page where the menu should appear. //--> <script language="JavaScript"> // Set the target window or frame // _top opens in the same window // _blank opens in a new window // Use the frame name to open to a frameset target var theTarget = "_blank"; function goThere(){ if(!document.theForm.theMenu.selectedIndex==""){ window.open(document.theForm.theMenu.options[document.theForm.theMenu.selectedIndex].value,theTarget,"");}} </script> <form name="theForm"> <select name="theMenu" size=1 onChange="goThere()"> <option selected value="">Happy Codings :-) JavaScript Code Examples <option value="http://javascript.happycodings.com/">Item One <option value="http://html-css.happycodings.com/">Item Two <option value="http://cplusplus.happycodings.com/">Item Three <option value="http://java.happycodings.com/">Item Four <option value="http://www.happycodings.com/">Item Five </select> </form>