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

Any good PHP developer looking for change

1 Answers  


How to generate a form?

0 Answers  


Explain about PHP filter and why it should be used?

0 Answers  


Is it easy to learn wordpress?

0 Answers  


How can we display the output directly to the browser?

0 Answers  






What are the functions to be used to get the image's properties (size, width and height)?

0 Answers  


How to create a session? How to set a value in session? How to remove data from a session?

0 Answers  


How do I find out the number of parameters passed into function9?

0 Answers  


<?php /** * @version 1.0 $ * @package HelloWorld * @copyright (C) 2005 Andrew Eddie * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?> <?php $database =& JFactory::getDBO(); //$sql = 'SELECT name, username FROM #__users'; $sql="select a.id, a.title, a.introtext, a.created_by, a.created from jos_content a, jos_content_frontpage b where a.id=b.content_id and b.ordering='2'"; $database->setQuery( $sql ); $user = NULL; $user = $database->loadObject(); //echo 'Name: ' . $user->name . '<br />'; echo '<h1>' . $user->title . '</h1><br />'; //echo 'Username: ' . $user->username; echo ' ' . $user->introtext; i write this and fetch the result from the database the result is The Intranet is up and working ! Our intranet is up and working and should be accessible from both Mumbai and NOIDA. As you will notice, this template, look & feel is not in line with our corporate indentity but we chose the route of "form-follows-funtion" In the first phase, we are rolling out functionality that is critical to all of us - Policies and How-to documents. In subsequent phases, we will be launching other features. Keep watching this space for more details i want to see only 4 line of top then how this may done

0 Answers   Infovision,


Is there any function to find repeated value in an array? What is w2 standard

1 Answers  


What is difference between get and post?

0 Answers  


How do you call a constructor for a parent class?

0 Answers  


Categories