在Body中追加 代码:
@H_301_2@ 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 @H_301_2@ 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找到标签,然后再追加到进去
原文链接:https://www.f2er.com/vb/256676.html