Call:
Copy codeThe Code is as follows:
<Script type = text/javascript src = http://fw.qq.com/ipaddress charset = "gb2312"> </script>
<Script type = text/javascript>
Document. write (IPData. join (''));
</Script>
The result is as follows:
202.105.128.73 Shenzhen City, Guangdong Province
If the ip address is not used as long as the region, the call is:
Copy codeThe Code is as follows:
<Script type = text/javascript src = http://fw.qq.com/ipaddress> </script>
<Script type = text/javascript>
Document. write
(IPData [2]); document. write (IPData [3]);
</Script>
The result is as follows:
Shenzhen City, Guangdong Province
The above Code also has a skill: UTF-8 page reference external code for gbk js file encoding Processing
Bytes. The charset setting introduces garbled JavaScript files encoded as gbk in the UTF-8 page. And there is no need for additional Write Functions to handle GBK to UTF-8 encoding, also for GBK page reference encoding for UTF-8 encoding JavaScript files if garbled problem occurs.
Source: http://shanyou.cnblogs.com/