display selected value in dropdown list through javascript
without page refresh

Answers were Sorted based on User's Feedback



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

Answer / himanshu

for this purpose we have to use ajax via we call another php
file which make the string of dropdown list

Is This Answer Correct ?    405 Yes 109 No

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

Answer / drorasta

you don't need to use AJAX for this. Just a simple
javascript:

<html>
<body>

<script type="text/javascript">
function showSelected(val){
document.getElementById
('selectedResult').innerHTML = "The selected number is - "
+ val;
}
</script>

<div id='selectedResult'></div>

<select name='test' onChange='showSelected(this.value)'>
<option value='1'>one</option>
<option value='2'>two</option>
</select>

</body>
</html>

Is This Answer Correct ?    375 Yes 116 No

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

Answer / dhir

<html>
<body>

<script type="text/javascript">
var show
function showSelected()
{
show
=document.me.test.options[document.me.test.selectedIndex].value;

document.write(show);
}
</script>
<form name="me">
<select name='test' onChange='showSelected()'>
<option value='1'>one</option>
<option value='2'>two</option>
</select>
</form>
</body>
</html>

Is This Answer Correct ?    169 Yes 102 No

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

Answer / apeksha

<HTML>
<BODY>

<SCRIPT>
function getSelect(s)
{
return s.options[s.selectedIndex].value
}
</SCRIPT>


<SELECT NAME="list" OnChange="location=getSelect(this)">
<OPTION value="#"> Choose a search engine
<OPTION value="http://www.yahoo.com"> Yahoo
<OPTION value="http://www.lycos.com"> Lycos
<OPTION value="http://www.excite.com"> Excite
</SELECT>


</BODY>
</HTML>

Is This Answer Correct ?    102 Yes 58 No

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

Answer / pinakini

one dropdown value are pass from another dropdown value with
javascript

Is This Answer Correct ?    80 Yes 60 No

Post New Answer

More PHP Interview Questions

What is htaccess in php?

0 Answers  


Tell us how to set cookies in php?

0 Answers  


what are interfaces and Abstart classes

0 Answers   Net Solution,


How we load all classes that placed in different directory in one php file , means how to do auto load classes.

0 Answers  


Explain the difference b/w static and dynamic websites?

0 Answers  






Explain what is the static variable in function useful for?

0 Answers  


In mail($param1, $param2, $param3, $param4), the $param2 contains__

1 Answers  


can any one find and tell the difference between dot net and php which one is best ? which one we get more salary? which one is stable and which one is best for freshers and also better in future and carrer ? which one we wil get more salary sir ? please send ur valuable suggestions to kiranpulsar2007@gmail.com

0 Answers  


Explain the difference between urlencode and urldecode?

0 Answers  


full form of php??

12 Answers   HCL,


What is the difference between $var and $$var?

0 Answers  


This question is regarding version control. If two developers are committing the same php file at same time what will happen ? What error it will show (if any) ?

2 Answers   TCS,


Categories