K
kebians
Hi,
I am using AddEvent Menthod with the following code for adding
multiple even handlers for same object within same event. ie. call 2
or more functions when click event of a button fires...
my code works fine... the code is as follows:
<code>
function addEvent( obj, type, fn ) {
if (obj.addEventListener) {
obj.addEventListener( type, fn, false );
}
else if (obj.attachEvent) {
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}
else {
obj["on"+type] = obj["e"+type+fn];
}
}
</code>
I attach events like following:
<code>
addEvent(myInputObj, 'click', isEmpty);
addEvent(myInputObj, 'click', isNumber);
addEvent(myInputObj, 'click', isInRange);
</code>
here the code works fine... three functions isEmpty, isNumber,
isInRange serially fires when a user clicks myInputObj.
Now my problem starts here. I have checked the conditions in each
functions and set the flags to true or false. I want to execute the
remaining functions if and only current function returns true. I don't
want to run isNumber and isInRange if isEmpty returns false.
any help can be appreciable.
thanks,
KoolKabin
I am using AddEvent Menthod with the following code for adding
multiple even handlers for same object within same event. ie. call 2
or more functions when click event of a button fires...
my code works fine... the code is as follows:
<code>
function addEvent( obj, type, fn ) {
if (obj.addEventListener) {
obj.addEventListener( type, fn, false );
}
else if (obj.attachEvent) {
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}
else {
obj["on"+type] = obj["e"+type+fn];
}
}
</code>
I attach events like following:
<code>
addEvent(myInputObj, 'click', isEmpty);
addEvent(myInputObj, 'click', isNumber);
addEvent(myInputObj, 'click', isInRange);
</code>
here the code works fine... three functions isEmpty, isNumber,
isInRange serially fires when a user clicks myInputObj.
Now my problem starts here. I have checked the conditions in each
functions and set the flags to true or false. I want to execute the
remaining functions if and only current function returns true. I don't
want to run isNumber and isInRange if isEmpty returns false.
any help can be appreciable.
thanks,
KoolKabin