dongtuwu8548 2014-05-08 16:37
浏览 36
已采纳

Firefox Windows 7中的javascript错误,在其他浏览器中运行操作系统

Hi this code seems to work fine in all browsers, just firefox in windows 7, is giving this issue, in firefox windows 8 (firefox 28,29) its ok. so i dont get it

This is a page i did not write, but im fixing some issues, this particular error its out of my knowledge wich is very basic yet.

So firefox gives this error

ReferenceError: autoExpire is not defined.

my first tought was to define var autoExpire; in javascript. But then looking at code there is a function autoExpire () is this the issue? why is working in other browsers, why is not working on windows 7?

Hope you can help me , here is the code.

    if(Get_Cookie('<?php echo COOKIE_REMEMBER_ME;?>') ==0)
    {
        if(Get_Cookie('<?php echo COOKIE_LOGINID;?>'))
        var aexp=setInterval(autoExpire,10000);


        if(!autocount)
        {
            var autocount;
            autocount=0;
        }

        function autoExpire()
        {
            autocount=autocount+1;
            if(autocount > parseInt(<?php echo COOKIE_EXPIRY_TIME*6;?>))
            {
                clearInterval(aexp);
                window.location.href='<?php echo $this->make_base_url("user/logout/a");?>';
            }
        }
    }

EDIT

Yes, this function is inside

$(document).ready(function() {

    }

With other functions to, the only error i can see is this thats why i just copy the function with error.

  • 写回答

1条回答 默认 最新

  • duanjunao9348 2014-05-08 16:44
    关注

    You're calling the function before it's defined.

    Try this.

    if (Get_Cookie('<?php echo COOKIE_REMEMBER_ME;?>') == 0) {
        if (Get_Cookie('<?php echo COOKIE_LOGINID;?>'))
    
        function autoExpire() {
            autocount = autocount + 1;
            if (autocount > parseInt( <? php echo COOKIE_EXPIRY_TIME * 6; ?> )) {
                clearInterval(aexp);
                window.location.href = '<?php echo $this->make_base_url("user/logout/a");?   >';
            }
        }
    
        var aexp = setInterval(autoExpire, 10000);
    
        if (!autocount) {
            var autocount;
            autocount = 0;
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 请问如何在openpcdet上对KITTI数据集的测试集进行结果评估?
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗