求帮忙写一个html或者js代码,实现访问网站检测访问地区,当地区不是一定地区时弹出一个提示!
<script language='javascript' type='text/javascript' src='http://ip.ws.126.net/ipquery'></script>
<script>
var ipinfo = localAddress["province"] + localAddress["city"];
if (
ipinfo.toString().indexOf("北京") != -1 ||
ipinfo.toString().indexOf("上海") != -1 ||
ipinfo.toString().indexOf("广州") != -1 ||
ipinfo.toString().indexOf("深圳")!= -1 ||
ipinfo.toString().indexOf("长春")!= -1
) {
alert(ipinfo)
} else {
alert("不在上面判断地区")
}
</script>