Hi all!
I currently populate a select box using an external js file. this js loops through an object and populates the select box. My question is, is there a faster way of doing this? The drop down lists are somtimes 1000's of entrys long, so a quicker way would be brilliant.
thanks
My code is:
Kenneth Birney
User Interface Programmer
Scottish Police
I currently populate a select box using an external js file. this js loops through an object and populates the select box. My question is, is there a faster way of doing this? The drop down lists are somtimes 1000's of entrys long, so a quicker way would be brilliant.
thanks
My code is:
Code:
var GunTypedropDownObject = [{ text:"", value:"235.003000"},
{ text:"Rimfire Rifle", value:"1.003000"},
{ text:"22 Centrefire Rifle", value:"2.003000"},
{ text:"Centrefire Rifle", value:"3.003000"},
{ text:"Muzzleloader", value:"4.003000"},
{ text:"Smooth Bore Gun", value:"5.003000"},
{ text:"Spare Barrels", value:"6.003000"},
{ text:"Rimfire Rifle-B/Action", value:"7.003000"},
{ text:"Rimfire Rifle-F/Block", value:"8.003000"},
{ text:"Rimfire Rifle-L/Action", value:"9.003000"},];
function fillGunTypeSelect() {
var select = document.getElementById( 'GunType' );
var options = select.options;
options.length = 0;
for( var i = 0; i < top.headerFrame.GunTypedropDownObject.length-1; i++ ) {
options[ options.length ] = new Option(top.headerFrame.GunTypedropDownObject[i].text, top.headerFrame.GunTypedropDownObject[i].value);
}
}
User Interface Programmer
Scottish Police