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 array_merge() and array_merge_recursive() in php?

538


What is regex in html?

504


What does addslashes do in php?

527


How to set cookies in PHP?

593


How to support multiple-page forms?

555






How to implement a class named dragonball. This class must have an attribute named ballcount (which starts from 0) and a method ifoundaball. When ifoundaball is called, ballcount is increased by one. If the value of ballcount is equal to seven, then the message you can ask your wish is printed, and ballcount is reset to 0. How would you implement this class?

621


How to add 301 redirects in PHP?

471


What is active record in php?

471


Explain mysql_error().

548


Differences between get and post methods?

521


What is the purpose of the '.frm' file extension? What do thes file contain?

504


How to open a file in php?

612


What does a dependant variable mean?

553


What exactly is validating and sanitizing?

615


Tell me how is the ternary conditional operator used in php?

560