Posted by: h4ck@lyst | October 22, 2007

javascript::dropdown menu

The following code is to select the id value of the selected option of a dropdown menu. It includes the html code as well.


<SCRIPT LANGUAGE=javascript>
function OnChange(dropdown)
var myindex = dropdown.selectedIndex
var SelValue = dropdown.options[myindex].value
var baseURL = <Some value based on SelValue>
top.location.href = baseURL;

return true;



<body >

<form name=”form1″>
<select name=”menu” onChange=”alert(‘test::’[].id)” value=”GO”>
<option value=”http://a&#8221; id=”aAnkit”>anshu</option>
<option value=”http://2&#8243; id=”2@bubbles”>2prateek</option>
<option value=”http://3&#8243; id=”3#prajwal”>3pratik</option>

Basically the format follows as



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: