I'm making a small website and within that website there is a <select></select> tag. I want to automaticly fill the select when the user presses a key.
Alright? Now let go to the problem, all of the above work fine in Chrome but it doesnt work in IE. Can someone show me a way to make it work in IE?
This is what im working with:
// Action that gets triggered by textfield 2
function CheckTwo() {
if (event.keyCode == 13) {
AddToList();
document.getElementById("two").value = "";
GiveFocus("two");
}
}
function AddToList()
{
var box = document.getElementById("selectbox");
var newoption = document.createElement("option");
newoption.text = document.getElementById("two").value;
box.add(newoption);
}
// Create array of all the items of the <select></select>
function CalculateList()
{
var barcodes = [];
var options = document.getElementsByTagName("option");
for (var i = 0; i < options.lenght; i++)
{
barcodes.push(options[i].text);
}
var barcodestring = barcodes.join(",");
}
I dont think the html is relevant for this kind of question becuase i believe that internet explorer cant handle the javascript. But here it is in case it is the problem:
<tr>
<td>Bonregel:</td>
<td><input type="text" name="bonregel" id="two" onkeyup="CheckTwo()" /></td>
</tr>
<tr>
<td>Bonlijst:</td>
<td><select id="selectbox" multiple></select></td>
</tr>
<tr>
if