elviswang
Posts: 3
|
| Posted: 11/19/2004, 12:06 AM |
|
Dear all,
I have a table in database like:
sn name
-------------------------------
1 elvis
2 dennis
also, there is 'ListBox1' can select 'sn' and ' Label1' want to show corresponding 'name'.
how to use ListBox1 onChange event to change the value of Label1.
|
 |
 |
zeuch
Posts: 25
|
| Posted: 11/19/2004, 3:16 AM |
|
Hi elvis,
you can use this code:
<html>
<head>
<title>Set Label Function</title>
<script type="text/javascript">
function setLabel(obj) {
document.getElementById("label").innerHTML = obj.value;
return false;
}
</script>
</head>
<body>
<form>
<select width="10" onchange="return setLabel(this);">
<option></option>
<option value="this is the option 1">1</option>
<option value="this is the option 2">2</option>
</select>
<span id="label"></span>
</form>
</body>
</html>
To use this code you must to have the name in value attribute of the option. Javascript don't to access the server data base 
Regards
_________________
Matheus Zeuch |
 |
 |
|