display selected value in dropdown list through javascript
without page refresh

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does mvc stand for and what does each component do?

773


Which function parses an English textual date or time into Unix timestamp in PHP.

807


What is lazy loading in php?

724


How to get elements in reverse order of an array in php?

793


What is difference between isset and empty in php?

773


How to read a file in binary mode?

863


What is the correct line to use within the php.ini file, to specify that 128mb would be the maximum amount of memory that a script may use?

809


Explain how is it possible to cast types in php?

767


What is the function file_get_contents() usefull for?

765


Explain converting an object?

823


How to Retrieve a Cookie Value?

791


Applications written to provide a GUI shell for Unix and Linux are called

815


Do you know when sessions ends?

779


What is php explain?

716


What is super keyword in c++?

791