使用VB 6.0+webBrowser控件,我想取的如下html文档中的.mystyle1和.mystyle2中的具体样式,应该怎么做?
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<style>
<!--
.mystyle1     { font-size: 18pt; color: #FFFF00; text-decoration: blink; text-align: left; 
               line-height: 150%; word-spacing: 2; border: 1px dashed #0000FF; 
               background-color: #000099 }
.mystyle2     { font-size: 18pt; color: #FFFF00; text-decoration: blink; text-align: left; 
               line-height: 150%; word-spacing: 2; border: 1px dashed #0000FF; 
               background-color: #000099 }-->
</style>
</head><body><table border="5" width="700" bordercolor="#99CCFF" id="table1" height="400">
<tr>
<td width="353" class="mystyle"></td>
<td> </td>
</tr>
</table></body></html>

解决方案 »

  1.   

    想法相同,再具体点:
    1. 用inet或webBrowser控件得到网页源代码;
    2. 作文本打开分析它,用instr找到“{”与“}”中的字符串,
    3. 用split分解,得到数据
      

  2.   


        for (var i = 0; i < document.all.length; i++)
        {
            if (document.all[i].tagName == "STYLE")
            {
                alert(document.all[i].innerHTML);
            }
        }
    通过WebBrowser取得页面的document对象,就可以使用以上类似代码取得style了
      

  3.   

    枚举header里面的<style>,然后对每个<style>调用IHTMLStyleElement::styleSheet