ComboBox set value to TextField : Option Select ComboBox : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » Option Select ComboBox »

 

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>
           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Option Select ComboBox