display selected value in dropdown list through javascript
without page refresh

Answer Posted / rrajeswari

Try this code


<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;
}
//-->

</SCRIPT>
<select name=select1 onchange='OnChange(this.form.select1);'>
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
</select>

Is This Answer Correct ?    11 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between associative array and indexed array?

749


What is the best practice for running mysql queries in php? Consider the risk of sql injection.

793


Write a program to find the factorial of a number in php?

750


How can I prevent sql-injection in php?

795


What is session data?

739


Tell me whether it is possible to share a single instance of a memcache between multiple php projects?

776


How to call a php function from html button?

807


What is session in c#?

745


How do you parse and process html/xml in php?

759


What are the array functions in php?

731


What is the function of string in c?

776


What is regular expression in php?

760


What is meant by pear in php? What is the purpose of it?

724


What is the use of count() function in php?

737


What is the difference between the functions strstr() and stristr()?

764