I've created a global variable to pass informatin to a method that is called via a method reference
d_g.onerror=i_bm_err_fix;
I tried passing it the variable like this(below) but it did not work.
d_g.onerror=i_bm_err_fix(d_g);
All I'm trying to do is have a generic image load if the site favicon does开发者_如何学运维 not.
function i_bm_err_fix(d_g)
{
d_g.src='http://www.archemarks.com/favicon1.ico';
}
Currently I'm using a global variable to pass this info. but this does not seem like good practice.
If I understand what you're trying to do correctly, this should do the trick:
d_g.onerror = function() {
i_bm_err_fix(d_g);
}
Wouldn't this work?
var myFunc = function(myargument){
alert(myargument);
};
myFunc('Hello, World');
精彩评论