![]() Topic awaiting preservation: Cross Browser onchange() (Page 1 of 1) |
|
|---|---|
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-13-2005 16:38
code: if (inputobj.hasAttribute("onchange")){
inputobj.onchange();
}
code: if (inputobj.onchange){
inputobj.onchange();
}
|
|
Paranoid (IV) Inmate From: USA |
posted 07-13-2005 16:50
I've had a similar problem -- it seems that MSIE does not allow you to call an event handler as a function (which is pretty stupid, but oh well -- I'll save the MS rant for another time). code: functon fooHandler () {
... do stuff ...
}
inputobj.onchange = fooHandler;
... later ...
fooHandler(); // instead on inputobj.onchange();
|
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-13-2005 16:55
Ok, that makes a bit of sense. |
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-13-2005 16:58
|
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-13-2005 17:16
code: if (inputobj.hasAttribute){
if(inputobj.hasAttribute("onchange")){
inputobj.onchange();
}
} else if (inputobj.onchange){
var change = inputobj.onchange;
change = change.replace("this","inputobj");
eval(change);
}
|