Webbrowser控件为已经有样式的标签添加样式 [英] Webbrowser control add style to tags already having style

查看:816
本文介绍了Webbrowser控件为已经有样式的标签添加样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 在vb6网页浏览器控制中,我想为backgrpund color设置样式属性。如果P.getAttribute(name)=mybookmarkthen 
P.Style.cssText =background-color:#FFFFEB
如果
/ pre>

但是如果我这样做,那么它会覆盖样式属性(如果有的话)。例如,如果存在< A name =mybookmarkstyle =font-size:12px> abc< / A> 的HTML标记,现有样式添加背景颜色属性。

解决方案

添加到现有样式,而不是替换它:)



P.Style.cssText =background-color:#FFFFEB; & P.Style.cssText


In vb6 web browser control i am want to set style property for backgrpund color.I am doing it as shown below

If P.getAttribute("name") = "mybookmark" Then
    P.Style.cssText = "background-color:#FFFFEB"
End If

But if i do this then it overrides the style properties if any are there already. for example if a html tag with <A name="mybookmark" style="font-size:12px">abc</A> exists then my code will remove existing style add background color property. So how to add style property for existing one?

解决方案

Add to the existing style rather than replace it :)

P.Style.cssText = "background-color:#FFFFEB;" & P.Style.cssText

这篇关于Webbrowser控件为已经有样式的标签添加样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆