ComboBox set value to TextField
<html>
<head>
<title>test</title>
<script language="JavaScript">
function PrintValues(){
var myString = document.mainform.file.value
var myStringLength = myString.length
var Comma = myString.lastIndexOf(',')
var SufNumChars = Comma + 1
document.mainform.result.value=('');
for(i=0; i<Comma; i++)
document.mainform.result.value+=(myString.charAt(i));
document.mainform.result.value+=(' ');
for(i=SufNumChars; i<myStringLength; i++)
document.mainform.result.value+=(myString.charAt(i));
}
</script>
</head>
<body>
<form name="mainform">
<p>
<select name="file" size="1" onchange="PrintValues();" target="_parent._top"
onmouseclick="this.focus()">
<option value="Joe,Yin">First Option</option>
<option value="Hi,Me">Second Option</option>
</select>
<input name="result">
</form>
</body>
</html>
Related examples in the same category