Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer internet explorer上的异步消息_Internet Explorer_Asynchronous_Message - Fatal编程技术网

Internet explorer internet explorer上的异步消息

Internet explorer internet explorer上的异步消息,internet-explorer,asynchronous,message,Internet Explorer,Asynchronous,Message,我正试图解决一个问题。基本上,我需要在长时间运行的Javascript代码上显示“加载消息”,并在代码结束时将其隐藏,例如: showMessage() executeMyCode() 隐藏信息() 然而,我在Internet Explorer上运行时遇到了一些问题,现在看起来页面在所有脚本代码完成之前都是冻结的,这可能会让用户感到恼火。我尝试了一种使用setTimeout()的方法,但这不起作用,你们有人解决了这个问题吗?谢谢你的帮助 提前感谢。您可以这样做: function showMes

我正试图解决一个问题。基本上,我需要在长时间运行的Javascript代码上显示“加载消息”,并在代码结束时将其隐藏,例如:

showMessage()

executeMyCode()

隐藏信息()

然而,我在Internet Explorer上运行时遇到了一些问题,现在看起来页面在所有脚本代码完成之前都是冻结的,这可能会让用户感到恼火。我尝试了一种使用setTimeout()的方法,但这不起作用,你们有人解决了这个问题吗?谢谢你的帮助


提前感谢。

您可以这样做:

function showMessage(){
    /* show message */;
    window.delay=setTimeout(executeMyCode,100); // Give some time to browser to render message
    return;
}

function executeMyCode(){
    clearTimeout(window.delay);
    /* execute long running code */
    /* hide message */
    return;
}
虽然在执行长代码时浏览器仍将被冻结,但用户现在可以看到消息