ITPub博客

首页 > 应用开发 > > 帮我解读这段Javascript代码,谢谢

帮我解读这段Javascript代码,谢谢

作者:deeply 时间:2019-08-14 14:16:10 0 删除 编辑

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/1978/viewspace-3155849/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 论程序员的戾气
请登录后发表评论 登录
全部评论

注册时间:2008-05-30

  • 博文量
    215
  • 访问量
    24533