简体   繁体   English

如何使用document.getElementById(someid).onclick标记a

[英]How can I use document.getElementById(someid).onclick for tag a

I want to automate to click on some link in a website. 我想自动单击网站上的某些链接。

since links on webpage are not direct link such as www.example.com/1.html. 由于网页上的链接不是直接链接,例如www.example.com/1.html。

it shows following link address for all the links I am interested in clicking 它会显示我感兴趣的所有链接的以下链接地址

javascript:void(1)


following is the html code for that link I want to click 以下是我要单击该链接的html代码

<a href="javascript:void(1)" onclick="server_playOn(17,2, 'est', this);">
                     Life OK  
                  </a>

一旦获得对链接的引用,就可以使用click方法:

referenceToLink.click();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM