View Full Version : try to solve this

10-16-2003, 10:11 AM
Hi Guys,

plz try to solve this problem

I have a dropdown box with values and I need to display the selected value near the dropdown box in a label and cannot use textbox or anyother box, this should be dynamic and so whenever I change my selected value the text should also change, remember that I cannot use textbox or button, just plain text, if you can plz mail me the code at pratikmodi@rediffmail.com

Thanks and Regards

10-16-2003, 10:26 AM
Welcome to the forum. Next time you should put a more descriptive subject. Read the posting guidelines (http://www.codingforums.com/postguide.htm).
Back to your problem..

<script type="text/javascript">
function displayValue(objSel){
document.getElementById('desc').innerHTML = objSel.options[objSel.selectedIndex].value;
<select name="s" onchange="displayValue(this)">
<option value="">--Select one---</option>
<option value="This is item 1">item 1</option>
<option value="This is item 2">item 2</option>
<option value="This is item 3">item 3</option>
<span id="desc"></span>

10-16-2003, 11:59 AM

Thanks u very much for the prompt reply and help, it is working.