Javascript innerHTML替换上的错误分配

Javascript innerHTML替换上的错误分配,javascript,variable-assignment,innerhtml,Javascript,Variable Assignment,Innerhtml,我以前从未用Javascript做过任何事情,在尝试用tampermonkey创建chrome用户脚本后,我似乎无法完成此操作。。。这个函数工作得很好,但是当我继续这样做的时候,我总是得到一个错误的赋值或者没有错误,但是这个动作不会通过。。。这可能看起来非常难看或糟糕,但根据文本是否为25-1,有没有关于如何进行替换的建议 谢谢所有能帮忙的人 function W01() { if (/another 25 seconds before attempting to search

我以前从未用Javascript做过任何事情,在尝试用tampermonkey创建chrome用户脚本后,我似乎无法完成此操作。。。这个函数工作得很好,但是当我继续这样做的时候,我总是得到一个错误的赋值或者没有错误,但是这个动作不会通过。。。这可能看起来非常难看或糟糕,但根据文本是否为25-1,有没有关于如何进行替换的建议

谢谢所有能帮忙的人

function W01() 
{       
if (/another 25 seconds before attempting to search again/i.test (document.body.innerHTML) )
{
    document.body.innerHTML() = document.body.innerHTML.replace('Sorry, but you can only perform one search every 25 seconds. Please wait another 25 seconds before attempting to search again.', 'Press F5 or Reload the page now');
}
else if (/another 24 seconds before attempting to search again/i.test (document.body.innerHTML) )
{
    document.body.innerHTML() = document.body.innerHTML.replace('Sorry, but you can only perform one search every 25 seconds. Please wait another 24 seconds before attempting to search again.', 'Press F5 or Reload the page now');
}
    else if (/another 23 seconds before attempting to search again/i.test (document.body.innerHTML) )
    {
        document.body.innerHTML() = document.body.innerHTML.replace('Sorry, but you can only perform one search every 25 seconds. Please wait another 23 seconds before attempting to search again.', 'Press F5 or Reload the page now');
    }
}
删除
innerHTML()
中的
()

应该是:

document.body.innerHTML = "some HTML";
请注意,它不是一个函数。这是一种财产

例如,请执行以下操作:

document.body.innerHTML = document.body.innerHTML.replace('Sorry, but you can only perform one search every 25 seconds. Please wait another 23 seconds before attempting to search again.', 'Press F5 or Reload the page now');

我如何将此应用于替换文本?很高兴能够提供帮助;)