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
What is the difference between associative array and indexed array?
What is the best practice for running mysql queries in php? Consider the risk of sql injection.
Write a program to find the factorial of a number in php?
How can I prevent sql-injection in php?
What is session data?
Tell me whether it is possible to share a single instance of a memcache between multiple php projects?
How to call a php function from html button?
What is session in c#?
How do you parse and process html/xml in php?
What are the array functions in php?
What is the function of string in c?
What is regular expression in php?
What is meant by pear in php? What is the purpose of it?
What is the use of count() function in php?
What is the difference between the functions strstr() and stristr()?