0 out of 1 rated this helpful - Rate this topic

HtmlDocument.InvokeScript Method

Executes an Active Scripting function defined in an HTML page.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method InvokeScript(String) Executes an Active Scripting function defined in an HTML page.
Public method InvokeScript(String, Object[]) Executes an Active Scripting function defined in an HTML page.
Top

The following code example executes the contents of a script in a Web page. The code example requires that you have loaded the following Web page.

<HTML>
<SCRIPT>
function test(name, address) {
window.alert("Name is " + name + "; address is " + address);
}
</SCRIPT>

<BODY>
</BODY>
</HTML>
private void InvokeTestMethod(String name, String address)
{
    if (webBrowser1.Document != null)
    {
        Object[] objArray = new Object[2];
        objArray[0] = (Object)name;
        objArray[1] = (Object)address;
        webBrowser1.Document.InvokeScript("test", objArray);
    }
}
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.