您的位置:首页 > Web前端 > JavaScript

JS获取IP经纬度,地址等

2014-03-07 16:14 113 查看
/article/8428053.html

<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 onload=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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: