且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-08 16:43:50

它适用于Navigate()方法。我只是尝试使用Windows Mobile 5.0掌上电脑模拟器。

It works with the Navigate() Method. I just tried it with the Windows Mobile 5.0 Pocket PC Emulator.

例如:

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()"));