display selected value in dropdown list through javascript
without page refresh



display selected value in dropdown list through javascript without page refresh..

Answer / 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

More PHP Interview Questions

Can we use php variable in javascript?

0 Answers  


What is restful api?

0 Answers  


What are different types of errors available in Php?

0 Answers  


When do sessions end?

0 Answers  


What is the definition of a session?

0 Answers  






What is Gd PHP?

0 Answers  


What is difference between rest api and restful api?

0 Answers  


How to create a web form?

0 Answers  


Which operator is used to concatenate two strings in PHP?

0 Answers  


How to insert an new array element in array?

0 Answers  


Does exist in php?

0 Answers  


How break and continue while loop in php?

0 Answers  


Categories