一个可以显示IP查询位置地图的PHP程序!(网速慢,发重复了,请版主删除这个)
演示:http://www.ipfox.com.cn/原理:借助google maps显示其IP所在地地图位置。(需要申请个google的key)
文件:你自己的IP查询程序+一个HTML页即可
HTML文件2.htm代码
引用格式:http://www.ipfox.com.cn/2.htm?湖南省株洲市
2.htm代码:
<script src="http://ditu.google.com/maps?file=api&v=2.x&key=ABQIAAAAxrryO9ztNllJV478OHgoUhSldR1ND_txlcuxRl8_AG4iJh50ABTWAsb98SF8PpXkDnxpLXR4LWsFug&hl=zh-CN" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
var address;
if (document.location.search == ""){
address= "";
}else{
address= document.location.search.substr(1);
}
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert("不能解析: " + address);
document.write("载入地址发生错误!请联系ipfox.com.cn管理员");
} else {
map.setCenter(point, 13);
var icon = new GIcon (G_DEFAULT_ICON, "ipfox.gif");
icon.iconSize = new GSize (32, 39);
var marker = new GMarker(point, icon);
map.addOverlay(marker);
map.enableScrollWheelZoom();
map.addControl(new GSmallMapControl());
map.addControl(new GScaleControl());
//map.addControl(new GMapTypeControl());
var txt = "<div style=\"font-family:Arial,Helvetica,Sans Serif;font-size:11px;text-align:center\">";
txt += "你所查询的IP所在地<br><font color=ff0000>";
txt += address+"</font><br>地理位置坐标<br>ipfox.com.cn为您提供"
txt += "<" + "/div>";
marker.openInfoWindowHtml(txt);
}
}
);
}
}
}
</script>
</head>
<body onLoad="initialize()" onUnload="GUnload()">
<div id="map_canvas" style="width: 500px; height: 340px">正在载入IP地理位置图...</div>
[local]1[/local][local]2[/local][local]3[/local]
[[i] 本帖最后由 文人 于 2008-4-28 09:15 编辑 [/i]]
经典铃声哪个网站有好听的下载?(22)
*** 作者被禁止或删除 内容自动屏蔽 *** 谢谢,收藏 现在还用不上 哎呀,这个东东我才发现呀,太爽了.不错.顶一下.页:
[1]