想调用搜狐的那个ip接口,那个值老是提示 undefinded
大家帮我看看吧
document.write('<script type="text/javascript">var returnCitySN={};</scrip'+'t>');
document.write('<script type=text/javascript src=http://pv.sohu.com/cityjson></scrip'+'t>');
var City=returnCitySN;
alert(City["cname"]);
就是想获取这个 cname的值。。。
------解决方案--------------------
- JScript code
document.write('<script type="text/javascript">var returnCitySN={};</scrip' + 't>'); document.write('<script type=text/javascript src=http://pv.sohu.com/cityjson></scrip' + 't>'); window.onload = function () { var City = returnCitySN; alert(City["cname"]); }