例如以下html:
<html>
<head>
    <title>无标题页</title>    <script src="jquery-1.8.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function(){
    $("#Hidden1").val("123");
    });  
    </script>
</head>
<body>
    <input id="Hidden1" type="hidden" />
</body>
<html>
请问,在winform中使用webbrowser怎么获取html中的input(hidden)的value值WinForm

解决方案 »

  1.   

    试一下  webbrowser1.Document.GetElementById("Hidden1").GetAttribute("value")
      

  2.   


    private void PrintHelpPage()
    {
        // Create a WebBrowser instance. 
        WebBrowser webBrowserForPrinting = new WebBrowser();    // Add an event handler that prints the document after it loads.
        webBrowserForPrinting.DocumentCompleted +=
            new WebBrowserDocumentCompletedEventHandler(PrintDocument);    // Set the Url property to load the document.
        webBrowserForPrinting.Url = new Uri(@"\\myshare\help.html");
    }private void PrintDocument(object sender,
        WebBrowserDocumentCompletedEventArgs e)
    {
        // Print the document now that it is fully loaded.
        ((WebBrowser)sender).Print();    // Dispose the WebBrowser now that the task is complete. 
        ((WebBrowser)sender).Dispose();
    }代码来自msdn:
    http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted.aspx