J
Jonathan Ellis
I have some code that looks like this:
var options = document.sform.files.options
for (var i = 0; i < options.length; i++) {
options.selected = true
}
As it loops you can see the options scroll by while IE renders each
one. For a couple hundred options this is okay, but I need to handle
up to 10,000. (Long story.) Is there a way to hint to IE that "hey,
I'm going to do a lot of these, wait until we're all done before
repainting?" Or is there a better way to speed things up?
Sample html:
<html>
<body>
<script language=javascript>
function selectall() {
var options = document.sform.files.options
for (var i = 0; i < options.length; i++) {
options.selected = true
}
}
</script>
<form name=sform>
<select name=files multiple size=10>
<option>foo
<!-- repeat option line a few thousand times -->
</select>
<input type=button onclick="selectall()" value="select">
</form>
</body>
</html>
Thanks,
-Jonathan
var options = document.sform.files.options
for (var i = 0; i < options.length; i++) {
options.selected = true
}
As it loops you can see the options scroll by while IE renders each
one. For a couple hundred options this is okay, but I need to handle
up to 10,000. (Long story.) Is there a way to hint to IE that "hey,
I'm going to do a lot of these, wait until we're all done before
repainting?" Or is there a better way to speed things up?
Sample html:
<html>
<body>
<script language=javascript>
function selectall() {
var options = document.sform.files.options
for (var i = 0; i < options.length; i++) {
options.selected = true
}
}
</script>
<form name=sform>
<select name=files multiple size=10>
<option>foo
<!-- repeat option line a few thousand times -->
</select>
<input type=button onclick="selectall()" value="select">
</form>
</body>
</html>
Thanks,
-Jonathan