Export (0) Print
Expand All

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.

  Name Description
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);
    }
}
Show:
© 2014 Microsoft