How to execute javascript using the mshtml
mshtml.HTMLDocumentClass doc = (mshtml.HTMLDocumentClass)IE.Document;
object script= doc.Script;
object[] args = { FirstArgument , "FrameContent", "tree.aspx", "FrameNav" };
script.GetType().InvokeMember("ZweiFrames",
System.Reflection.BindingFlags.InvokeMethod,
null, script,args);
Marshal.ReleaseComObject(script);
I used the above code to execute java script and getting an error.(Exception has been thrown by the target of an invocation) ( inner Exception : Insufficient memory to continue the execution of the开发者_开发百科 program).
Please help me on this..
Thanks in advance.. Unni.
Have you checked ZweiFrames
js function - may be there is issue in that function with arguments supplied by you?
BTW, yet another way to execute javascript function can be something like
HTMLWindow2 iHtmlWindow2 = (HTMLWindow2) doc.Script ;
iHtmlWindow2.execScript( "functionName(param1);" , "javascript" );
This is of course assuming that your parameters can be represented in a string form.
精彩评论