...

View Full Version : try to solve this



pratikmodi
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
Pratik

glenngv
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..


<html>
<head>
<script type="text/javascript">
function displayValue(objSel){
document.getElementById('desc').innerHTML = objSel.options[objSel.selectedIndex].value;
}
</script>
</head>
<body>
<form>
<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>
</select>
<span id="desc"></span>
</form>
</body>
</html>

pratikmodi
10-16-2003, 11:59 AM
Hi,

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

Regards
Pratik



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum