O
Oskar
Hi.
I'm have a page thas shows a list of items and a text input box. The
text input box works as a filter and the javascript hides the elements
that do not contain the String from the input box.
In firefox this works perfect.. in IE6 I can't get it working, anybody
an idea?
source:
<html>
<body>
<script>
function filter(obj){
var veld = document.getElementById('list');
var str=obj.value;
for (var loop= (veld.options.length-1) ; loop >= 0; loop--){
if (veld.options[loop].text.search(str) == -1){
veld.options[loop].style.display = 'none';
}
else{
veld.options[loop].style.display = '';
}
}
}
</script>
<input type="text" onkeyup="filter(this)"/>
<select multiple="multiple" class="swapfield" size="10" name="list"
id="list">
<option value="1">Wout Netjes</option>
<option value="2">Trudi Netjes</option>
<option value="3">jeroen Bos</option>
<option value="4">Marietje Bos</option>
</select>
</body>
</html>
I'm have a page thas shows a list of items and a text input box. The
text input box works as a filter and the javascript hides the elements
that do not contain the String from the input box.
In firefox this works perfect.. in IE6 I can't get it working, anybody
an idea?
source:
<html>
<body>
<script>
function filter(obj){
var veld = document.getElementById('list');
var str=obj.value;
for (var loop= (veld.options.length-1) ; loop >= 0; loop--){
if (veld.options[loop].text.search(str) == -1){
veld.options[loop].style.display = 'none';
}
else{
veld.options[loop].style.display = '';
}
}
}
</script>
<input type="text" onkeyup="filter(this)"/>
<select multiple="multiple" class="swapfield" size="10" name="list"
id="list">
<option value="1">Wout Netjes</option>
<option value="2">Trudi Netjes</option>
<option value="3">jeroen Bos</option>
<option value="4">Marietje Bos</option>
</select>
</body>
</html>