function ss(id){
var script=document.createElement('script');
script.src='....'+ip;
document.getElementsByTagName('head')[0].appendChild(script);
document.write(...)
}
这样试试  如果返回的还是以前的 看看script好像有个load还是什么事件  放在那个回调里试试
或者直接发个ajax请求啊

解决方案 »

  1.   

     // 动态导入js
    function include(src,encoding,fun) 

        var s =document.createElement('script');   
        s.type='text/javascript';
        s.charset=encoding; //'gb2312';
        s.src = src;   
        var tags =document.getElementsByTagName('head');   
       if(typeof(fun)=='function'){
            if( document.all ){
               s.onreadystatechange = function(){
                    if(/(complete|loaded)/.test(this.readyState)){
                          fun(); s.onreadystatechange = null; s.parentNode.removeChild(s); 
                     }};
           }else{
                 s.onload = function(){  fun(); s.onload = null; s.parentNode.removeChild(s); };
           }
        } 
        tags[0].appendChild(s); 
    };function getIP(ip){
    include("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip="+ip,"utf-8",
    function(){if(remote_ip_info){var i=remote_ip_info;alert('IP归属地:' + i['country'] + i['province'] + i['city'] + i['isp']);}});
    }