subhailc
04-29-2006, 09:08 PM
hi - on a small scale, this works finefunction find(a,b){
for(var c in b)if(b[c]==a)return c;}
useful for qualifying objects and getting events
var obj={name:"mark",age:32,smoker:true};
alert(find(32,obj));
//or
function showevent(a){
return find(arguments.callee.caller,a);}
//....
<button onclick="alert(showevent(this))">click</button>
when passed window or self, it breaks - just guessing, but i got past it a couple times on blind luck, and it seems like there's one property of the window object that doesnt have a constructor - eh now im doubting my memory... anyways if anybody knows how to loop through the window object props i'd appreciate hearing it
for(var c in b)if(b[c]==a)return c;}
useful for qualifying objects and getting events
var obj={name:"mark",age:32,smoker:true};
alert(find(32,obj));
//or
function showevent(a){
return find(arguments.callee.caller,a);}
//....
<button onclick="alert(showevent(this))">click</button>
when passed window or self, it breaks - just guessing, but i got past it a couple times on blind luck, and it seems like there's one property of the window object that doesnt have a constructor - eh now im doubting my memory... anyways if anybody knows how to loop through the window object props i'd appreciate hearing it