<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<title>获取ip地址</title>
<!-- 需要转码 -->
<script language="javascript" src="http://fw.qq.com/ipaddress" charset="gb2312"></script>
<script type="text/javascript">
function test(){
// ip地址
alert(IPData[0]);
// 省份
alert(IPData[2]);
// 市区
alert(IPData[3]);
}
</script>
</head>
<body onload="test();">
</body>
</html>