我以前从来没有做过任何关于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');
}
}
答案 0 :(得分:2)
删除()
中的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');