关于webbrowser的,在线等,谢谢各位了
System.Timers.Timer t = new System.Timers.Timer(5000);t.Elapsed += new System.Timers.ElapsedEventHandler(theout);
t.AutoReset = false;
t.Enabled = true;
public void theout(object source, System.Timers.ElapsedEventArgs e)
{
string js2 = "var h1 = window.frames['downFrame'].frames['leftFrame'].document.getElementsByTagName('a')['link5'].href;" +
"window.frames['downFrame'].frames['mainFrame'].location = h1;";
wb1.execScript(true, js2, "javascript");
}
就是想定时执行javascript代码,提示错误如下:
用户代码未处理 System.InvalidCastException
Message=指定的转换无效。
Source=mscorlib
StackTrace:
在 System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
在 IfacesEnumsStructsClasses.IHTMLDocument2.get_parentWindow()
在 csExWB.cEXWB.execScript(Boolean bTopLevel, String ScriptName, String ScriptLanguage)
在 IcbcAutoClient.GoICBC.theout(Object source, ElapsedEventArgs e) 位置 E:\Workspace\VS2010_C#_workspace\sgl_icbcautoclient\Form1.cs:行号 461
在 System.Timers.Timer.MyTimerCallback(Object state)
InnerException:
补充:.NET技术 , C#