IHTMLElement.getAttribute 出现参数无效的解决方法

2017-03-31 20:46:14来源:CSDN作者:webouse人点击

调用 IHTMLElement.getAttribute('href') 时,如果被调用的链接是错误的链接,比如 <a href="http://[%aaa">abc</a>,也就是说href后面是个错误的url时,会出现“无效参数”错误对对话框。

改进方法 IHTMLElement.getAttribute('href', 2),也就是增加一个参数,参数说明如下

0: Default. Performs a property search that is not case-sensitive, and returns an interpolated value if the property is found.
1: Performs a case-sensitive property search. To find a match, the uppercase and lowercase letters in strAttributeName must exactly match those in the attribute name.
2: Returns attribute value as a BSTR. This flag does not work for event properties.
4: Returns attribute value as a fully expanded URL. Only works for URL attributes.

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台