在Body中追加 代码:
Private Sub cmdAddPic_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles cmdAddPic.Click Dim el As HtmlElement = web.Document.CreateElement("div") el.InnerHtml = "<a href=''>test</a>" el.Id = "id1" web.Document.Body.AppendChild(el) el = Nothing End Sub
Private Sub cmdAddPic_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles cmdAddPic.Click el = web.Document.CreateElement("div") el.InnerHtml = "test2" el.Id = "id2" web.Document.GetElementById("id1").AppendChild(el) el = Nothing End Sub
其实就是先通过GetElementById找到标签,然后再追加到进去