欢迎光临
我们一直在努力

VB调用webbrowser技巧集2-.NET教程,VB.Net语言

建站超值云服务器,限时71元/月

向webbrowser中写入html内容的几种方法

首先在form_load中加入

webbrowser1.navigate "about:blank"

确保webbrowser1可用

方法1:

dim s as string

dim stream as istream

s = ""

s = s + ""

s = s + ""

s = s + "

hello world

"

s = s + ""

s = s + "

webbrowser1.document.write s

方法2:

dim o

set o = webbrowser1.document.selection.createrange

debug.print o

if (not o is nothing) then

o.pastehtml "哈哈"

set o = nothing

end if

方法3:

插入文本框

dim o

set o = webbrowser1.document.selection.createrange

o.execcommand "inserttextarea", false, "xxx"

其中方法3是采用了调用execcommand并且传递控制命令的方法,通过这种方法还可以插入图片等页面元素,详情可以参考msdn的execcommand命令。

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » VB调用webbrowser技巧集2-.NET教程,VB.Net语言
分享到: 更多 (0)