源代码:
StringBuilder sb = new StringBuilder();
sb.AppendLine("function tempFunction() {");
sb.AppendLine(" return '10';");
sb.AppendLine("}");
sb.AppendLine("document.getElementById('J_SubmitStatic').onclick=tempFunction();");
var task = frame.EvaluateScriptAsync(sb.ToString());
task.ContinueWith(t =>
{
if (!t.IsFaulted)
{
var response = t.Result;
if (response.Success == true)
{
MessageBox.Show(response.Result.ToString());
}
}
}, TaskScheduler.FromCurrentSynchronizationContext());
网友评论