Jump to content

how to make a navigation with <select>?


Recommended Posts

  • 1 month later...

Hey guys,


I'm trying to make a selection menu that when a selection is made, will redirect to another page, and each option acts as a link.


Would anyone be able to explain the easiest way to do so or point me in the right direction?


Javascript would be a right direction for that.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Select a site</title>

<script language="javascript">

function func()
var i = document.myform.myselect.selectedIndex;
var site = document.myform.myselect.options[i].value;

<form name="myform">
<select name="myselect">
<option value="http://www.somesite.com">somesite.com</option>
<option value="http://www.anothersite.com">anothersite.com</option>
<input type="button" value="go to the selected site" onclick="func();" />



I believe that should do it. You can tweak it to your preference

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...