By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,382 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,382 IT Pros & Developers. It's quick & easy.

A couple language questions

P: n/a
1) I want to test for the existence of a method o.m(), so I tried the line
if (o.m) ...
but the interpreter objects to the missing parentheses on m. (This is in
IE.) What is an appropriate approach for checking the existing of a
function?

2) I've got the following code
window.onresize = function {
....
f();
}
function f() {
....
}
<BODY onload="f();">

My question: if the resize event happens while f is executing, is the first
call to f (onload) flushed from the stack? If not, where in f is execution
resumed after the second call to f takes place in response to the resize
event?

Thanks.

Ken
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Ken Kast" <kn*@kenkast.com> wrote in message
news:be**********@gateway.northgrum.com...
1) I want to test for the existence of a method o.m(), so I tried the line
if (o.m) ...
but the interpreter objects to the missing parentheses on m. (This is in
IE.) What is an appropriate approach for checking the existing of a
function?

if (typeof o == 'object' && typeof o.m == 'function') {
// Function exists
}
2) I've got the following code
window.onresize = function {
...
f();
}
function f() {
...
}
<BODY onload="f();">

window.onresize = f; // this is sufficient
My question: if the resize event happens while f is executing, is the first call to f (onload) flushed from the stack? If not, where in f is execution resumed after the second call to f takes place in response to the resize
event?


My guess is that the function will be called twice after the calls have been
queued.
JW

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.