以编程方式设置textarea不会';t工作C#
试图用代码设置textare,但它不起作用,我已经设置了输入字段,工作正常,没有任何问题以编程方式设置textarea不会';t工作C#,c#,webbrowser-control,geckofx,C#,Webbrowser Control,Geckofx,试图用代码设置textare,但它不起作用,我已经设置了输入字段,工作正常,没有任何问题 GeckoElementCollection TextAreaCollection = geckoWebBrowser.Document.GetElementsByTagName("textarea"); foreach (GeckoElement textArea in TextAreaCollection) { string textAreaName = textArea.GetAt
GeckoElementCollection TextAreaCollection =
geckoWebBrowser.Document.GetElementsByTagName("textarea");
foreach (GeckoElement textArea in TextAreaCollection)
{
string textAreaName = textArea.GetAttribute("name");
if (textAreaName == "message")
{
((GeckoHtmlElement)textArea).Focus();
// ((GeckoHtmlElement)textArea).SetAttribute("value", selectedAD.description);
((GeckoHtmlElement)textArea).TextContent = selectedAD.description;
}
}
您不需要在该元素上设置焦点来填充值。
而不是将对象强制转换为GeckoHtmlElement,而是将其强制转换为GeckoTextAreaElement并设置Value属性
(textArea作为GeckoTextAreaElement)。Value=“某物,某物,某物,黑暗面”;
希望这有帮助:)