VB.NET webbrowser控制器 无法在文本框中设置值
<input name="ctl00$ContentPlaceHolder1$txtUsername" type="text" id="ctl00_ContentPlaceHolder1_txtUsername" style="width:95%;" class="TextBoxWatermark" autocomplete="off">
更多信息
var Page_Validators = new Array(document.getElementById("ctl00_ContentPlaceHolder1_RequiredFieldValidator1"), document.getElementById("ctl00_ContentPlaceHolder1_RequiredFieldValidator2"));
更多信息
document.getElementById('ctl00_ContentPlaceHolder1_RequiredFieldValidator1').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_ContentPlaceHolder1_RequiredFieldValidator1'));
}
更多信息
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.TextBoxWatermarkBehavior, {"ClientStateFieldID":"ctl00_ContentPlaceHolder1_txtUsernameWatermarkExtender_ClientState","WatermarkCssClass":"TextBoxWatermark","WatermarkText":"ตัวอย่าง mj99u53xxxxxxxx","id":"ctl00_ContentPlaceHolder1_txtUsernameWatermarkExtender"}, null, null, $get("ctl00_ContentPlaceHolder1_txtUsername"));
});
以及更多
document.getElementById('ctl00_ContentPlaceHolder1_RequiredFieldValidator2').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_ContentPlaceHolder1_RequiredFieldValidator2'));
}
我试过这段代码
webBrowser1.Document.All.GetElementsById("ctl00_ContentPlaceHolder1_txtUsername").SetAttribute("Value", "xxxxx");
它无法正常工作
答案 0 :(得分:1)
尝试:
webBrowser1.Document.GetElementsById("ctl00_ContentPlaceHolder1_txtUsername").SetAttribute("Value", "xxxxx");
没有All
属性。