0

What're differences between :

System . Windows . Browser . HtmlPage . Window . Eval ( ... );

System . Windows . Browser . HtmlPage . Window . Invoke ( ... );

What I reached till now is

Eval :

  • Apply JavaScript code applied withen it. ( Code written in Silverlight )
  • Invoke JavaScript global methods without parameters . ( Methods written in JavaScript )

Invoke :

  • Call JavaScript global methods with/out parameter/s. ( Methods written in JavaScript )

If I'm true, are there other differences ?
I really need a simple but powerful difference example.

MSDN References :

Finally, Which function doing a real injection ?

Regards,

4

1 回答 1

1

试试这个代码

HtmlPage.Window.Eval("function addElement(string){ var p = document.createElement('p'); p.innerHTML = string; document.body.appendChild(p);}")  
HtmlPage.Window.Eval("addElement('Eval function');")  
HtmlPage.Window.Invoke("addElement", "Invoke function")  

他在页面上添加了 2 段。和function 的
区别在于调用带(或不带)参数的函数并执行代码EvalInvokeInvokeEval

于 2013-04-22T05:58:16.657 回答