问题描述
在vb6网页浏览器控制中,我想为backgrpund color设置样式属性。如果P.getAttribute(name)=mybookmarkthen
/ pre>
P.Style.cssText =background-color:#FFFFEB
如果
但是如果我这样做,那么它会覆盖样式属性(如果有的话)。例如,如果存在
< 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控件为已经有样式的标签添加样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!