Javascript check if function exists -


I followed the creation of a new JS to flash the communication:

So my code looks like this Is:

  function getID (swfID) {if navigator.appName.indexOf ("Microsoft")! = -1) {me = window [swfID]; } And {me = document [swfID]; }} Function js_to_as (str) {me.onChange (str); }  

Now, my on change does not load, but currently, firebug displays

< P> me.onChange is not a function

error and completely stops

I want to show it very low because it is the most important in my program Not attribute. I tried typeof but it still gives the same error.

There is a suggestion on how to ensure that it exists and then only execute on

Try something like this

  if (typeof me .onChange! == "undefined") {// Safe to use function}  

Or better yet (according to

  if (typeof me.onChange === "function") {// safe to use function} HTML> 

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -