Call:
Copy Code code as follows:
<script type=text/javascript src=http://fw.qq.com/ipaddress charset= "gb2312" ></script>
<script type=text/javascript>
document.write (Ipdata.join ('));
</script>
Display results as:
202.105.128.73, Shenzhen, Guangdong province
Do not IP as long as the region's words are called:
Copy Code code as follows:
<script Type=text/javascript src=http://fw.qq.com/ipaddress></script>
<script type=text/javascript>
document.write
(ipdata[2]);d ocument.write (ipdata[3]);
</script>
Display results as:
Shenzhen city, Guangdong province
The above code also has one trick: UTF-8 page references the processing of JS file encoding with external encoding as GBK
Http://fw.qq.com/ipaddress, and this interface provides JS for GBK encoded, because the page is UTF-8 encoded, so again using the return of the city name on my page is garbled, and can not be referenced. Through the charset settings, the UTF-8 page to introduce encoded GBK JavaScript file garbled problem. and no additional write functions are required to handle GBK UTF-8 encoding, and the same is true for JavaScript files encoded GBK page references encoded as UTF-8 if there is a garbled problem.
Source: http://shanyou.cnblogs.com/