62,046
社区成员
发帖
与我相关
我的任务
分享
HtmlDocument hd = getCurrentBrowser().Document;
//webbrowser1.document.body.innertext
//hd.GetElementById("")
MessageBox.Show(hd.Body.InnerText.ToString() + hd.Body.InnerHtml.ToString());
IHTMLDocument2 doc = (IHTMLDocument2)getCurrentBrowser().Document.DomDocument;
mshtml.HTMLInputTextElement text1;
text1 = (HTMLInputTextElement)doc.all.item("input_id", 0);
MessageBox.Show(text1.value);
((mshtml.HTMLInputElement)(text1)).value = "warran";
//mshtml.IHTMLElementCollection collection = doc.all as mshtml.IHTMLDocument2;
//collection
//mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)getCurrentBrowser().Document;
//mshtml.IHTMLInputElement input = (mshtml.IHTMLInputElement)doc.all.item("input_id", 0);//这句报错了input.value;
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Main1.aspx.cs" Inherits="Main1" %>
<%@ Register Assembly="EeekSoft.Web.PopupWin" Namespace="EeekSoft.Web" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>汉翔软通电视购物管理系统</title>
</head>
<body>
<form id="agentform" name="agentform" runat="server">
<table style="width: 100%; height: 100%; table-layout: fixed" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td height="31">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="TopLeft">
<span class="TopInfo">
<asp:Literal ID="txtStf" runat="server"></asp:Literal></span></td>
<td class="TopBg">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="TopAle" nowrap>
</td>
<td class="TopTxt" nowrap>
号码:<asp:TextBox ID="myH2" runat="server" Style="background-color: GreenYellow; width: 110px;"></asp:TextBox>
</td>
<td class="TopAle" nowrap>
</td>
<td class="TopTxt" nowrap>
</td>
<td class="TopAle" nowrap>
</td>
<td class="TopTxt" nowrap>
</td>
<td class="TopAle" nowrap>
</td>
<td class="TopTxt" nowrap>
</td>
</tr>
</table>
</td>
<td class="TopRightImg">
</td>
<td class="TopRightBg">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr>
<td style="width: 175px; vertical-align: top; background: #E7F5FD;" id="frmleft">
<iframe src="Left2.aspx" style="width: 100%; height: 100%" frameborder="0"></iframe>
</td>
<td style="width: 6px; background: url(Images/switchbg.gif); vertical-align: middle;
white-space: nowrap;" id="splitBar">
<img src="Images/splitBar.gif" id="switchPoint" onclick="switchSysBar()" style="cursor: hand"
title="关闭/打开左边导航栏" alt="关闭/打开左边导航栏" />
</td>
<td>
<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%">
<tr>
<td>
<iframe name="MainFrame" id="MainFrame" src="Desktop.aspx" style="width: 100%; height: 100%;"
frameborder="0"></iframe>
</td>
</tr>
<tr>
<td height="20px">
<iframe src="Bottom.aspx" scrolling="no" style="width: 100%; height: 20px" frameborder="0">
</iframe>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
public void HtmlTextChanged(Object sender, EventArgs e)
{
Console.WriteLine("Enter TextChanged");
}
private void button2_Click(object sender, EventArgs e)
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement element = doc.GetElementById("txtCustEmail");
element.AttachEventHandler("onpropertychange", new EventHandler(HtmlTextChanged));
string value = element.GetAttribute("value");
element.SetAttribute("value","new email");
}