0

我得到了以下代码,但“如果”部分不起作用,任何人都可以帮助我吗?非常感谢~

<!-- 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 -->
4

1 回答 1

0

改成这个==。您正在使用=which 是赋值运算符。使用==运算符检查是否相等。

if (mylocation=="AU")
 ... 
else if (mylocation=="CA")
于 2013-01-31T09:37:28.793 回答