Getelementbyclass - 问题 [英] Getelementbyclass - Issue

查看:94
本文介绍了Getelementbyclass - 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




if(webbrowser1.documenttext.contains

{

webbrowser1.document.getelementbyid(aria-id-) 29371579884).InvokeMember(点击)

messagebox.show

}





但是getelementbyclass不存在怎么能通过获得一个类来实现相同的结果



ps创建一个新线程,因为它是一个不同的问题,但我知道它仍然是相关的

Hi
if (webbrowser1.documenttext.contains
{
webbrowser1.document.getelementbyid(aria-id-29371579884).InvokeMember("Click")
messagebox.show
}


However getelementbyclass does not exists how can i achieve the same result by by getting a class instead

p.s made a new thread because it is a different question but i know it is still related

推荐答案

不要尝试按类来做!如果你想使用一个唯一元素,只有属性 id 应该保证唯一性。确保你有id =aria-id-29371579884。使用:

Don''t try to do it by class! If you want to use one unique element, only the attribute id is supposed to guarantee uniqueness. Make sure you have id="aria-id-29371579884". Use:
someElement = document.getElementById("aria-id-29371579884"); // note casing and quotation marks!
// do something with the element





按类和许多其他选择器进行选择,请查看jQuery:http://api.jquery.com/category/selectors/ [ ^ ]。



请记住,除 id选择器之外的所有选择器都会为您提供元素集,不一定是一个。



-SA



For selection by class and many other selectors, check out jQuery: http://api.jquery.com/category/selectors/[^].

Remember that all selectors except the id selector gives you the set of element, not necessarily one.

—SA


这篇关于Getelementbyclass - 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆