Drop Down Box with automatic redirect

Drop Down Box with automatic redirect

We can do drop down box with automatic redirect using Java script. The following Java script code will enable visitors to click on a drop down box to select the location on web site in which they would like to navigate. Once they make their selection, they will automatically be taken to the location.

We can place this code where we would like the box to appear:

<Script language=”JavaScript”>
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 VALUE=”">——-Choose a Selection——</option>
<OPTION VALUE=”index.html”>Home
<OPTION VALUE=”main_page.html”>Main page
<OPTION VALUE=”contact.htm”>Contact us
</SELECT>
</FORM>

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.