Webbrowser SetAttribute不起作用(密码字段)

HtmlElementCollection inputs = doc.GetElementsByTagName("input"); 
HtmlElement usr = inputs.GetElementsByName("username")[0]; 
usr.setAttribute("value", strUsername); 

HtmlElement pwd = inputs.GetElementsByName("password")[0]; 
pwd.GotFocus += new HtmlElementEventHandler(pwd_GotFocus); 
pwd.Focus(); 



void pwd_GotFocus(object sender, HtmlElementEventArgs e) 
{ 
    HtmlElement pwd = (HtmlElement)sender; 
    pwd.SetAttribute("value", strPassword); 
} 
posted @ 2022-05-01 18:40  左正  阅读(28)  评论(0编辑  收藏  举报