首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

winform中使用webbrowser如何获取html中的input(hidden)的value

2013-06-25 
winform中使用webbrowser怎么获取html中的input(hidden)的value例如以下html:htmlheadtitle无标题页

winform中使用webbrowser怎么获取html中的input(hidden)的value
例如以下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
[解决办法]
试一下  webbrowser1.Document.GetElementById("Hidden1").GetAttribute("value")
[解决办法]


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

热点排行