首页 > 开发 > JS > 正文

JS 解决跨域问题

2024-09-06 12:40:49
字体:
来源:转载
供稿:网友

var A = document.createElement(“script”) , B = document.getElementsByTagName(“head”)[0];
A.src = “http://comment.sports.163.com/data/sports_nba_bbs/df/5C472DDM00051CA1_1.html”;
A.language = “javascript”;
A.type = “text/javascript”;
A.onload = A.onreadystatechange = function(){
alert(this.readyState); //onreadystatechange
alert(“A”);
}

FF:onload IE:onreadystatechange

var A = document.createElement(“img”) , B = document.getElementsByTagName(“body”)[0];
A.src = “http://img.openv.tv/t/UserFiles/Image/20090612/20090612_1709056640541058.jpg”;
A.onload = A.onreadystatechange = function(){
alert(this.readyState);
alert(“A”);
}
B.appendChild(A);

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表