在WebBrowser里执行JS脚本操作CSS
function BIdName(sname) { return document.getElementById(sname).style; } function BClassName(sname) { for (var i=0;i<document.styleSheets.length;i++) { var rules; if (document.styleSheets[i].cssRules) { rules = document.styleSheets[i].cssRules; } else { rules = document.styleSheets[i].rules; } for (var j=0;j<rules.length;j++) { if (rules[j].selectorText == sname) { return rules[j].style; } } } } BClassName(".top").display = "none"; //操作class的CSS BIdName("beitou").display = "none"; //操作ID的CSS 不要带#