0

所以我想做一个这样的脚本:

window.location = "http://m.roblox.com/Catalog/VerifyPurchase?assetid=122174821&type=robux&expectedPrice=1"
document.getElementsByClassName('buyButtonClass')[1].click()

但我不知道如何刷新页面并重新开始代码,而无需再次手动输入谢谢

顺便说一句,它将在 Google Chrome Dev 中运行。工具控制台

我试过了

function blah() {
// window.location = "http://m.roblox.com/Catalog/VerifyPurchase?
assetid=122174821&type=robux&expectedPrice=1"
document.getElementsByClassName('buyButtonClass')[1].click()
if (some_condition) {
blah() // rerun the code
}
}

输出是“未定义的”,脚本什么也没做。

脚本转到一个链接,单击一个按钮(目前由于某种原因它没有单击)然后重新启动脚本(不工作)

4

1 回答 1

1

设置 window.location = ... 将刷新页面,但之后的内容不会触发,因为您刚刚刷新了包含所有 javascript 的页面。您可以将要触发的代码放入 $(document).ready(function(){your_code_here}); 调用,当页面刷新时,它将设置您的点击事件。

于 2013-07-27T05:16:04.533 回答