Thanks pete. There's an easier way to do anything :)

function findError(code) {
  for(var name in Components.results)
    if(Components.results[name] == code)
        return code + " is " + name;  
  return code + " not found"
}

John.

pete collins wrote:
> 
> And now the function. Hey!
> 
> --pete
> 
> function lookUp(aErrorNum) {
> 
>   var errors=new Array();
>   var t=Components.results;
>   var retval=false;
>   var num;
> 
>   for(var list in t)
>     errors.push(list);
> 
>   for(var i=0;i<errors.length;i++)
>   {
>     num=parseInt(eval("t."+errors[i]));
>     if(aErrorNum==num)
>       retval=errors[i];
>   }
> 
>   return retval;
> }

Reply via email to