最新消息:20210917 已从crifan.com换到crifan.org

【已解决】js中如何写函数

JS crifan 1465浏览 0评论

参考:

JavaScript 函数

代码:

function getUrlRespHtml_async(url, callback){
  var xmlHttp = new XMLHttpRequest();
  xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == ReadyState.DONE && xmlHttp.status == 200)
      callback(xmlHttp.responseText);
  }
  xmlHttp.open("GET", url, true);
  xmlHttp.send(null);
}
function gotStHtml(respHtml){
  // alert(respHtml);
  console.log(respHtml);
}
/*
  Loving You Allexinno Mirabela 试听 — SongTaste 用音乐倾听彼此
  http://www.songtaste.com/song/3498546/
*/
var stUrl = "http://www.songtaste.com/song/3498546/";
// var stUrl = "http://www.baidu.com";
getUrlRespHtml_async(stUrl, gotStHtml);

转载请注明:在路上 » 【已解决】js中如何写函数

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
99 queries in 0.195 seconds, using 23.33MB memory