gpt4 book ai didi

JavaScript 在 Firefox 中导致 "A script on this page may be busy, or it may have stopped responding."错误

转载 作者:行者123 更新时间:2023-11-30 09:09:46 26 4
gpt4 key购买 nike

我用 javascript 写了一个页面,有 1000 多行代码,所以页面很重。当我在 firefox 上运行页面时,它告诉我:

A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

Script: http://localhost:5070/resources/ir.pnusn.branch.ui.pages.BranchMap/scripts/MapAddress.js:151

我在 MyAddress.js:151:

function fillAddress(number)
{
150: var filedNum=0;
151: while(document.getElementById("choice4")!=null)
document.getElementById("choice4").click();
nextId=1;
for(i=0;;i++)
{
var cookieChoiceName=number+"-"+filedNum+"-0";
var cookieChoiceValue=getCookie(cookieChoiceName);
if(cookieChoiceValue==null)
{
//alert(document.getElementById("choice4"));
break;
}
var cookieFieldName=number+"-"+filedNum+"-1";
var cookieFieldValue=getCookie(cookieFieldName);
if(cookieFieldValue==null)
{
alert(document.getElementById("choice4"));
break;
}
if(cookieChoiceValue!= "-1" && cookieChoiceValue!="-2" && document.getElementById("choice"+cookieChoiceValue)!=null)
{
document.getElementById("choice"+cookieChoiceValue).click();
}
var value=utf8_decode(unescape(cookieFieldValue));
var finalval=replacePluse(value);
// var Resvalue=value.substr(1,value.length-1);
document.getElementById("txt"+(filedNum-1)).value=finalval;
filedNum++;
}
}

当我在警告窗口中按继续时,代码可以正常工作。但是当我在 firefox 配置文件中增加 dom.max_script_run_time 它不会改变之后,当我再次按下“继续”时,它就起作用了。有什么问题?如果您需要有关代码的更多信息,请告诉我在这里为您提供。

最佳答案

您的while 可能是一个无限循环。只要您有带有 id #choise4 的元素,您使用的条件将始终为真。由于您没有在循环内删除此元素,因此它永远不会完成。

关于JavaScript 在 Firefox 中导致 "A script on this page may be busy, or it may have stopped responding."错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1158393/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com