delphi WebBrowser 获取焦点 name
(WebBrowser1.Document as IHtmlDocument2).activeElement.id
上面这条可以得到网页焦点的id,但是网页焦点的name找了半天不知道怎么弄,大哥们帮帮小弟
[解决办法]
ID与Name的区别比想像的要大,LZ可以搜一下.
MSDN是这样描述的:
activeElement Property
Gets the object that has the focus when the parent document has focus.
Syntax
[ oActive = ] object.activeElement
object有ID属性,但Name属性主要Applies To:
Attr Constructor, A, APPLET, attribute, BUTTON, EMBED, FORM, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, MAP, OBJECT, RT, RUBY, SELECT, TEXTAREA, HTMLAnchorElement Constructor, HTMLButtonElement Constructor, HTMLEmbedElement Constructor, HTMLFormElement Constructor, HTMLImageElement Constructor, HTMLInputElement Constructor, HTMLMapElement Constructor, HTMLObjectElement Constructor, HTMLSelectElement Constructor, HTMLTextAreaElement Constructor
Name属性与内容有关,可能是这个原因吧。不敢肯定。