I have a page with a form and 201 select boxes with 29 options each. The first of the select boxes has an onChange event which triggers a function to change the values of the other 200.
In Firefox, this runs very well, but IE has a long delay when I click to open the first select box.
If someone can take a look at my code, below, and offer some advice, I would greatly appreciate it.
Based on W3Cs interpretation of the change event, I would think that the delay is coming before the event triggers, but MS's definition seems a little vague to me :
The part that's unclear, to me at least, is that MSs spec doesn't say that the event fires when the object loses focus. This may be my problem if it means that it fires exactly when the value changes.
Here's the JavaScript function :
Here's a subset of the code itself :
--
-- Ghodmode
In Firefox, this runs very well, but IE has a long delay when I click to open the first select box.
If someone can take a look at my code, below, and offer some advice, I would greatly appreciate it.
Based on W3Cs interpretation of the change event, I would think that the delay is coming before the event triggers, but MS's definition seems a little vague to me :
ref: Document Object Model EventsW3C said:The change event occurs when a control loses the input focus and its value has been modified since gaining focus. This event is valid for INPUT, SELECT, and TEXTAREA. element.
ref: onchange EventMicrosoft said:onchange Event
Fires when the contents of the object or selection have changed.
The part that's unclear, to me at least, is that MSs spec doesn't say that the event fires when the object loses focus. This may be my problem if it means that it fires exactly when the value changes.
Here's the JavaScript function :
Code:
function func_set_all( caller ) {
for ( i = 0; i < num_objs; i++ ) {
elm = form_obj.elements[i];
if ( elm.id.indexOf('loc_') != -1 ) {
elm.value = caller.value;
}
}
} // End set_all function
Here's a subset of the code itself :
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<head>
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
<title>without_location</title>
<link rel="stylesheet" type="text/css" href="css/menu.css" />
<link type="text/css" rel="stylesheet" href="css/without_location.css" />
<script type="text/javascript">
var xDT = parent.xDT;
</script>
<script type="text/javascript" src="js/quirksmode.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/without_location.js">
</script>
<script type="text/javascript">
processing();
</script>
</head>
<body onload="
parent.LOADED = 1;
/*
Moving these here was my first attempt at speeding up the code.
I thought that going through all of the form elements might be a
little expensive.
This didn't seem to have much effect.
*/
form_obj = document.getElementById( 'edit_locations_form' );
num_objs = form_obj.elements.length;
done_processing();
">
<h3>PERDANA ENTERPRISE</h3>
<form id="edit_locations_form" action="[URL unfurl="true"]http://home:9694/kqsbstart/without_location.pl"[/URL] method="post">
<input type="hidden" name="co_id" id="co_id" value="3" />
<div id="submit_button_block">
<input type="submit" value="Submit" />
</div>
<table id="edit_locations" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="4" class="right">Set all of these deliveries to :</td>
<td class="left">
<!--
This is the select-box that changes all of the others.
-->
<select name="set_all" id="set_all"
onchange="func_set_all(this);">
<option value="null">--</option>
<option value="17">Andus</option>
<option value="12">Beaufort</option>
<option value="8">Beverly Hill</option>
<option value="27">Bongawan</option>
<option value="16">Ex-Quarry</option>
<option value="20">G.F.Jetty</option>
<option value="4">Green Nursery Beringgis</option>
<option value="3">Inanam</option>
<option value="21">Jensun Const. S/B-MRSM KINARUT</option>
<option value="22">Jln. Safoda Jica, Papar.</option>
<option value="15">Kimanis</option>
<option value="13">Kinarut</option>
<option value="10">Lok Kawi Heights</option>
<option value="19">Luyang</option>
<option value="9">Maktab Rendah Sains Mara</option>
<option value="5">Melinsung</option>
<option value="7">Palm Beach Village-Kinarut</option>
<option value="26">Papar</option>
<option value="23">PDRM KINARUT</option>
<option value="11">Pem. Pusat Latihan Koperasi</option>
<option value="1">Penampang</option>
<option value="2">Petagas</option>
<option value="18">Pusat Latihan Koperasi</option>
<option value="25">Putatan</option>
<option value="14">Road maintenance jetty</option>
<option value="24">S.K.Nyaris-nyaris Bongawan</option>
<option value="28">Sepangar Bay</option>
<option value="6">Sg.muok kinarut</option>
<option value="29">Tg. Aru</option>
</select>
</td>
</tr>
<tr>
<th>#</th>
<th>Date</th>
<th class="left">Product</th>
<th>Weight<br />(tons)</th>
<th class="left">Location</th>
</tr>
<tr>
<td>1</td>
<td>20 Apr 2001 15:03:02</td>
<td class="left">3" Hard Core</td>
<td class="right">12.31</td>
<td class="left">
<!--
There are 199 more like this
-->
<select name="loc_101169" id="loc_101169">
<!-- same list as used for "set_all" -->
</select>
</td>
</tr>
</table>
</form>
</body>
</html>
--
-- Ghodmode