MSHTML HTMLHeadElementClass COM Error
问题 I'm currently working with MS HTML to insert a JavaScript code into websites. I made a reference to Microsoft HTML Object Library and types this code. IHTMLDocument2 doc = BrowserHost.Document as HTMLDocumentClass; IHTMLElement head = (IHTMLElement) ((IHTMLElementCollection)doc.all.tags("head")).item(null, 0); IHTMLScriptElement scriptObject = (IHTMLScriptElement)doc.createElement("script"); scriptObject.type = @"text/javascript"; scriptObject.text = TTS.TTSWebFactory.GetJavascript(); (