Tuesday, February 10, 2004

Safari, Mozilla and IE

I had to populate a selection box (drop down) using javascript. I eventually worked out an implementation that works for IE, Mozilla and Safari. It turned out to be simple.

First thing, IE uses Name of Id is missing. Mozilla doesn't. Supply IDs for everything. IE Documentation saies tell the document to create an option element, ... that doesn't work on anything except IE, but this did.

function InitialiseNumberSelector(list,min,max)

{
var index=0;
for ( num = min; num <= max; ++num)
{
list.options[index++]= new Option(num,num);
}
}
Post a Comment

GitHub Projects