调用 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.