drop down list link
This handy trick is used everywhere. A link is set for each item in the drop down list. You don’t have to even make the list an actual fully qualified form – leave out the form tags. You do, however, need to include the SELECT tag that the OPTION tags are nested within. The location is given as the value expressed in the value= attribute of the option tags. They can be absolute or relative URL’s. Simply click on the list item and you’re taken there by using the location= object that is standard in every browser. <html> <head> <script type="text/javascript"> function go() { location=document.forms[0].gowhere.value; } </script> </head> <body> <select id="gowhere" onchange="go()"> <option value="/asp/default.asp">ASP Coding</option> <option value="/flash/default.asp">Flash Tutorial</option> <option value="/js/default.asp">JavaScripts</option> </select> </body> </html> The list can be any size or complexity. Remember, though, that the text displayed as an option in the list has to be put within the opening and closing option tags. It is this that is displayed, not the text given in the value= attribute.
|