地理编码插件&页面重定向

时间:2013-01-31 09:33:18

标签: jquery

我得到了以下代码,但“if”部分无效,任何人都可以帮助我吗?非常感谢〜

<!-- auto detect visitor ip and redirect start -->
<script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script language="Javascript"> 
    var mylocation=geoplugin_countryCode();
    if (mylocation="AU") {
    window.location.href='http://www.propertyhere.com/Country/AU/search-to-buy'}
    else if (mylocation="CA") {
    window.location.href='http://www.propertyhere.com/Country/CA/search-to-buy'}
    else if (mylocation="CN") {
    window.location.href='http://www.propertyhere.com/Country/CN/search-to-buy'}
    else if (mylocation="NZ") {
    window.location.href='http://www.propertyhere.com/Country/NZ/search-to-buy'}
    else if (mylocation="RU") {
    window.location.href='http://www.propertyhere.com/Country/RU/search-to-buy'}
    else if (mylocation="US") {
    window.location.href='http://www.propertyhere.com/Country/US/search-to-buy'}
    else {
    window.location.href='http://www.propertyhere.com/network'}
</script>
<!-- auto detect visitor ip and redirect end -->

1 个答案:

答案 0 :(得分:0)

更改为此==。您使用的是=,它是赋值运算符。使用==运算符检查是否相等。

if (mylocation=="AU")
 ... 
else if (mylocation=="CA")
相关问题