Webbrowser control add style to tags already having style

坚强是说给别人听的谎言 提交于 2019-12-13 04:04:10

问题


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?


回答1:


Add to the existing style rather than replace it :)

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



来源:https://stackoverflow.com/questions/22811417/webbrowser-control-add-style-to-tags-already-having-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!