如何解决如何更改此textarea的值?
我要在此Website上设置文字
及其相对html
<textarea ng-model="textarea" allow-tab="" open-url="" character-count="" bind-input="update_contents();" ng-change="update_contents();" class="textarea ng-pristine ng-valid ng-not-empty ng-touched" spellcheck="false" placeholder="" style="font-size: 15px; height: 183.2px;"></textarea>
如果该textarea的值未出现在html中,如何更改它的值?我正在使用网络浏览器控件
谢谢
解决方法
您需要使用以下方法获取HtmlElement:
没有任何ID,因此排除了数字1。我个人将使用数字3,并使用一些调试技巧来确定数组中的哪一项是您所需的TextArea。
一旦有了HtmlElement,就可以将其InnerText属性设置为所需的值。
以下是演示您想要的示例:
Dim textareas = WebBrowser1.Document.GetElementsByTagName("textarea")
If (textareas.Length > 0) Then
' this assumes that the first item in the array is the desired TextArea,you may need to change the index
textareas(0).InnerText = "hello world"
End If
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。