[thelist] javascript detecting if function/var is already defined

Kristof Neirynck k.neirynck at belgacom.net
Thu Nov 27 12:16:48 CST 2003


christof.hoeke at e-7.com wrote:

> i have a problem with a script which depends on a function x() which may be defined or not, depending on the page.
> normally i (at least i think it worked) tried to find out if x is available by checking

if ( window.x ) {
	//x is defined
} else {
	//x isn't defined
}

<http://www.google.com/search?q=javascript+function+exists>
<http://www.faqts.com/knowledge_base/view.phtml/aid/1591>
<http://www.faqts.com/knowledge_base/view.phtml/aid/16419>
<http://www.quirksmode.org/js/support.html>


-- 
Kristof



More information about the thelist mailing list