- 论坛徽章:
- 0
|
此方法好像仅限返回json数据
var s = document.createElement("SCRIPT");
s.src="http://a.lulu.com/ip.do?type=json&"+new Date().getTime();
s.type = "text/javascript";
s.language = "javascript";
document.getElementsByTagName("HEAD")[0].appendChild(s);
if(document.all){
s.onreadystatechange = function(){//IE用
var state = s.readyState;
if (state == "loaded") {
City = returnCitySN.cname.split("-")[1];
Province = returnCitySN.cname.split("-")[0];
DataResetByIp();
}
};
} else {
s.onload = function() {//FF用
City = returnCitySN.cname.split("-")[1];
Province = returnCitySN.cname.split("-")[0];
DataResetByIp();
};
}
http://a.lulu.com/ip.do?type=json
内容格式要求
var returnCitySN = {cip:"10.1.1.1",cid:110000,cname:"北京-北京"}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/1184/showart_2053857.html |
|