http://blog.csdn.net/macwhirr123/article/details/7576634
<html>
<head>
<title>xxxxx</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<script type="text/javascript" src="http://www.ip-look-up.com/Services/ipInfo.js"></script>
</head>
<body οnlοad=aa();>
<SCRIPT LANGUAGE="JavaScript">
function aa(){
document.getElementById("lat").value = ipLocation.latitude;
document.getElementById("long").value = ipLocation.longitude;
document.getElementById("city").value = ipLocation.address.city;
document.getElementById("long").value = ipLocation.longitude;
document.getElementById("code").value = ipLocation.address.country_code;
document.getElementById("region").value = ipLocation.address.region;
document.getElementById("country").value = ipLocation.address.country;
}
</SCRIPT>
经度:<input type="text" id="lat"><br/>
纬度:<input type="text" id="long"><br/>
城市:<input type="text" id="city"><br/>
国家代码:<input type="text" id="code"><br/>
城市所属地区:<input type="text" id="region"><br/>
国家:<input type="text" id="country"><br/>
</body>
</html>