Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/384.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
Javascript 我想自动点击_Javascript - Fatal编程技术网

Javascript 我想自动点击

Javascript 我想自动点击,javascript,Javascript,我想在网站上自动点击这个链接 <a href="/wall/withdraw.php?processor=ppp">Withdraw</a> 谢谢 您可以使用它的click()方法启动它 <a href="/wallet/withdraw.php?processor=ppp" id="foo">Withdraw</a> document.getElementById("foo").click(); document.getElement

我想在网站上自动点击这个链接

<a href="/wall/withdraw.php?processor=ppp">Withdraw</a>


谢谢

您可以使用它的
click()
方法启动它

<a href="/wallet/withdraw.php?processor=ppp" id="foo">Withdraw</a>

document.getElementById("foo").click();

document.getElementById(“foo”)。单击();

你需要一些方法来选择元素,我给了它一个ID并使用了
getElementById()

你所说的自动单击是什么意思?我的意思是当页面加载包含此链接时,代码将在此链接上单击自动,然后继续下一页?我想要这样的代码:setTimeout(function(){document.evaluate(//input[@value='Submit Now'和@type='Submit'并包含(@class',button')]”,document,null,9,null)。singleNodeValue.click();},2000);这样就可以了?提前谢谢亲爱的!IIRC,您不能以编程方式单击链接。但是您可以读取href属性,并使用
window.location.replace
方法加载URL。@bvukelic谢谢,我是noob,您能告诉我如何添加window.location.replace的代码吗?但我无法编辑或删除它在这段代码中添加一个id,因为,这段代码不在我的站点中,我只想单击它,代码将单击此链接上的自动,并继续下一页?我想要这样的代码:setTimeout(function(){document.evaluate(//input[@value='Submit Now'和@type='Submit'并包含(@class',button'))”,document,null,9,null).singleNodeValue.click();},2000);这样行吗?谢谢你的回答,但这对我不起作用?@Umer你必须比“不起作用”更具体一些非常感谢,亲爱的,我对编码很在行,我只想自动点击一个html链接,但我无法在该链接中添加ID,因为我不是该网站的所有者。再次感谢兄弟。