chenyuan 2010-07-23
代码如下:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JavaScript API</title> <script type="text/javascript" src="http://j.maxmind.com/app/geoip.js"></script> </head> <body> <script type="text/javascript"> var area = ""; try { if(geoip_city() != "" && geoip_city() != null) area += geoip_city()+", "; if(geoip_region_name() != "" && geoip_region_name() != null) area += geoip_region_name()+", "; if(geoip_country_name() != "" && geoip_country_name() != null) area += geoip_country_name(); } catch(err) { area=""; } </script> </body> </html>