Sponsored Ad

Thursday, April 15, 2010

How to Add Link in Dropdown(Select) using JavaScript

Sometimes we need to to add links of another page or site with dropdown values. This example will help you to code this functionality using JavaScript code.

Call a method onchange of dropdown and inside that method write a line

document.forms[0].wheretogo.value

where wheretogo is dropdown name.  and it will open a corresponding page when user will select a option.

 

<html>
<head>
<script type="text/javascript">
function go()
{
location=document.forms[0].wheretogo.value
}
</script>
</head>
<body>
<form>
<select id="wheretogo" onchange="go()">
<option>-Select Destination location
<option value="
http://IndiHub.com">India New
<option value="
http://BharatClick">Free Indian Classifieds
<option value="
http://SharePointBank.com">Microsoft SharePoint Resources
</select>
</form>
</body>
</html>

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers