VB的Webbrowser如何用document.Write在指定的位置里插入html代码
2个回答
展开全部
如果你一定要用document.Write,可通过下面代码实现:
Dim S As String, Msg As String, Html As String
With WebBrowser1.Document
Msg = .body.innerHTML
S = "<table id=" & Chr(34) & "tb1" & Chr(34) & ">"
Html = "插入的代码"
i = InStr(1, Msg, S, vbTextCompare) '查找
If i > 0 Then
Msg = Left(Msg, i + Len(S) - 1) & Html & Mid(Msg, i + Len(S)) '插入
.Clear
.Open
.Write Msg '重写
.Close
WebBrowser1.Refresh '刷新
End If
End With
Dim S As String, Msg As String, Html As String
With WebBrowser1.Document
Msg = .body.innerHTML
S = "<table id=" & Chr(34) & "tb1" & Chr(34) & ">"
Html = "插入的代码"
i = InStr(1, Msg, S, vbTextCompare) '查找
If i > 0 Then
Msg = Left(Msg, i + Len(S) - 1) & Html & Mid(Msg, i + Len(S)) '插入
.Clear
.Open
.Write Msg '重写
.Close
WebBrowser1.Refresh '刷新
End If
End With
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Set newrow = WB.Document.getElementById("tb1").insertrow
Set newcol = newrow.insertCell
newcol.innertext = "现在时间是:" & Time()
End Sub
Private Sub Form_Load()
WB.Navigate App.Path & "\1.htm"
End Sub
Set newrow = WB.Document.getElementById("tb1").insertrow
Set newcol = newrow.insertCell
newcol.innertext = "现在时间是:" & Time()
End Sub
Private Sub Form_Load()
WB.Navigate App.Path & "\1.htm"
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询