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 are the file upload settings in configuration file?
How send email in php?
How can I use single quotes in single quotes in php?
Is php pass by reference or value?
What is the difference between the include() and require() functions?
Distinguish between urlencode and urldecode?
How to retrieve values out of an array?
Can the value of a constant change during the script's execution?
Where are cookies stored php?
Does php have future?
What is the difference between $var and $$var?
Explain what is the static variable in function useful for?
How to remove html tags from data in php?
What is the best practice for running mysql queries in php? Consider the risk of sql injection.
What is the use of imagetypes() method?