Rutworld
11-20-2002, 09:53 AM
I am having a problem with the following script. I wan the input entry to match the select box item exactly but it seems to be off by one number when typed into the input box.
Any input would be helpfull:)
Code:
<!--
<html>
<script>
//------------------------------------------------------------
//Find item in left select and highlight
//------------------------------------------------------------
function updateSelection() {
assyNumInput = document.getElementById('assemblyInput');
assyNum = assyNumInput.value;
assyNumLength = assyNum.length;
assyList = document.getElementById('assemblyItems');
i=0;
while(i<assyList.length && assyNum != assyList[i].text.substr(0,assyNum.length)) {
assyList.selectedIndex = 1;
i++;
}
assyList.selectedIndex = i;
}
</script>
<body>
<input id="assemblyInput" type="text" maxlength="20" size="20" value="" onKeyPress="updateSelection()">
<br>
<br>
<div id="assemblySelectView">
<select id="assemblyItems" size="15" class="assemblylist">
<option>102</option>
<option>10202</option>
<option>103</option>
<option>1030</option>
<option>104</option>
<option>1040</option>
</select>
</div>
</body>
</html>
-->
Any input would be helpfull:)
Code:
<!--
<html>
<script>
//------------------------------------------------------------
//Find item in left select and highlight
//------------------------------------------------------------
function updateSelection() {
assyNumInput = document.getElementById('assemblyInput');
assyNum = assyNumInput.value;
assyNumLength = assyNum.length;
assyList = document.getElementById('assemblyItems');
i=0;
while(i<assyList.length && assyNum != assyList[i].text.substr(0,assyNum.length)) {
assyList.selectedIndex = 1;
i++;
}
assyList.selectedIndex = i;
}
</script>
<body>
<input id="assemblyInput" type="text" maxlength="20" size="20" value="" onKeyPress="updateSelection()">
<br>
<br>
<div id="assemblySelectView">
<select id="assemblyItems" size="15" class="assemblylist">
<option>102</option>
<option>10202</option>
<option>103</option>
<option>1030</option>
<option>104</option>
<option>1040</option>
</select>
</div>
</body>
</html>
-->