Pass value from select list - Pass value from select list (Posted by HAI TRAN)
<html>
<head>
<script language="JavaScript">
<!-- hide script from old browsers
function displayValue(value) {
if (value != "") {
document.FORMNAME.xtext.value = value;
}
}
// end hiding from old browsers -->
</script>
</head>
<body>
<form name="FORMNAME">
<select size="1"
onChange="javascript:displayValue(this.options[selectedIndex].value)">
<option>
<option value="A">A
<option value="B">B
<option value="C">C
</select>
<input type="text" name="xtext">Selection?
</form>
</body>
</html>
----------
[email protected]
http://go.to/hass
HAI TRAN posted this at 04:00 — 10th November 1999.
They have: 4 posts
Joined: Sep 1999
I want to pass a selected value from select pull down list to a input text on the same page.
But the following codes never work. Any suggestions?
<html>
<head>
</head>
<form>
<body>
<select name="xselect" onChange="this.form.xtext.value=xselect.option[selectedIndex].value">
<option>
<option value="A">A
<option value="B">B
<option value="C">C
</select>
<input type="text" name="xtext">Selection?
</form>
</body>
</html>
HAI TRAN posted this at 02:57 — 11th November 1999.
They have: 4 posts
Joined: Sep 1999
It works, but I have to remove the if (value).
Thanks. It is very helpful from this website and forum!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.