Does anyone know if the Mac Browsers (IE5 / Safari) support anonymous
functions or lambda functions? Ive been trying to get a site working
with the Mac browsers and just cant get it to work. Here is an example
of what Im trying to do:
function CSelect(sName, id, bmpReqRO, minOptions, onvalid, isAddr,
sLabel){
this.obj = document.getElementById(id);
this.focus = m_focus;
this.blur = m_blur;
this.disable = m_disable;
this.enable = m_enable;
//alert(sName);
var slct = makeProps(this, bmpReqRO, id);
//alert(slct.required);
if (navigator.appVersion.indexOf("Mac") > -1)
{
slct.options = slct.obj.options;
}
else
{
slct.options = obj.options;
}
slct.label = sLabel;
slct.minOptions = minOptions;
slct.type = "Select";
if(onvalid)
slct.onvalid = new Function(onvalid);
slct.getValue = function slct_getValue(){
return slct.obj.value
}
if(slct.readOnly){
slct.disable();
}
//if(slct.obj.getAttribute("OnSelect")){
//slct.obj.onchangeFunc = slct.obj.onchange;
//slct.obj.onchange = new Function("onItemSelect(this)");
//}
if (navigator.appVersion.indexOf("Mac") > -1)
{
if(slct.obj.getAttribute("OnSelect")){
obj.onchangeFunc = slct.obj.onchange;
// THIS LINE DOES NOT WORK WITH THE MAC
obj.onchange = new Function("onItemSelect(this)");
}
}
else
{
if(slct.obj.getAttribute("OnSelect")){
slct.obj.onchangeFunc = slct.obj.onchange;
slct.obj.onchange = new Function("onItemSelect(this)");
}
}
.. . . Continued . . .
function onItemSelect(oSelect){
var oSelected = oSelect[oSelect.selectedIndex];
var onselect = oSelected.getAttribute("onSelect");
if(oSelect.onChangeFunc)
oSelect.onChangeFunc();
if(onselect){
var oSelectedFunc = new Function(onselect);
oSelectedFunc();
}
}