开发者

Combining two statements

开发者 https://www.devze.com 2023-04-02 04:00 出处:网络
How do I combine these two statements? e.onerror=i3d;function i3d(a){a.src=\'http://www.archemarks.com/favicon1.ico\';}

How do I combine these two statements?

e.onerror=i3d;function i3d(a){a.src='http://www.archemarks.com/favicon1.ico';}

e.onerror expects a reference to a function, but I just need to one statemen开发者_运维问答t as shown above.


Although I'd hardly call it much of an optimization, you can assign the function directly to the event handler...

e.onerror = function() { /* do something */ };


Is this what you want?

e.onerror=function(a){a.src='http://www.archemarks.com/favicon1.ico';};
0

精彩评论

暂无评论...
验证码 换一张
取 消