首页 > 应用开发 > > 帮我解读这段Javascript代码,谢谢
function jsonp(a, b, c) {
var d;
d = document.createElement('script');
d.src = a;
c && (d.charset = c);
d.onload = function() {
this.onload = this.onerror = null;
this.parentNode.removeChild(this);
b && b(!0); //---1
};
d.onerror = function() {
this.onload = this.onerror = null;
this.parentNode.removeChild(this);
b && b(!1); //---2
};
document.head.appendChild(d);
};
/*
这个函数啥用?1,2处代码是开关作用吗?
*/

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1834/viewspace-3168819/ ,如需转载,请注明出处,否则将追究法律责任。