代码之家  ›  专栏  ›  技术社区  ›  Chris Craft

在WebBrowser控件中从.NET Compact Framework调用javascript函数

  •  4
  • Chris Craft  · 技术社区  · 15 年前

    Is there anyway to call a JavaScript function from .NET Compact Framework through the WebBrowser control?

    1 回复  |  直到 14 年前
        1
  •  4
  •   Stefan Pühringer    14 年前

    它与navigate()方法一起工作。我刚用Windows Mobile 5.0 Pocket PC模拟器进行了测试。

    例如:

    webBrowser1.DocumentText = @"<html><head>
                <script type='text/javascript'>
                    function doIt() {
                        alert('hello again');
                        return 'i did it!';
                    }
                </script>
                </head><body>hello!</body></html>";
    webBrowser1.Navigate(new Uri("javascript:doIt()"));