我现在在做一个工具,主要功能是从BBS或论坛中解析出贴子的主题,作者,回复数等信息,并存入数据库中,经过身边同学的帮助,现在已经可以解析出HTML中的信息,但是有些BBS中涉及到Javascript,就有些无从下手,可能没说清楚,我举个例子吧!
以下是BBS里某一条内容: 
<table width=640 border=0 cellspacing=0> 
<tr height=20><td width=20><font face=wingdings color=blue>K</font>    </td><td width=370><a href='http://www.tianya.cn/publicforum/content/free/1/1544988.shtml'  target='_blank'>我所知道的月星家居——他们是如何侵吞国有财产的</a></td> 
<td width=90><a href='/browse/Listwriter.asp?vwriter=韩榕华' target=_blank onmouseover="if(typeof(im_popMenu)!='undefined'&&im_popMenu) im_popMenu(this,'韩榕华','韩榕华')" onmouseout="if(typeof(im_beginCloseMenu)!='undefined'&&im_beginCloseMenu) im_beginCloseMenu(this);">韩榕华</a></td> 
    <td width=35 align=center class=tdfont>2624</td> 
    <td width=35 align=center class=tdfont>346</td> 
    <td width=90 align=center class=tdfont>4-23 15:57</td> 
</table> 
如果我想读取出其中的主题,作者,回复数等信息可以按以下实现: 
foreach (HtmlElement htmtd in htmelt.GetElementsByTagName("td")) 
                        { 
                            switch (j) 
                            { 
                                case 0: 
                                    break; 
                                case 1: 
                                    if (htmtd.InnerText != null) 
                                    { 
                                        HtmlElement htmtltle = htmtd.GetElementsByTagName("a")[0]; 
                                        bbstitle = htmtltle.InnerText.Replace("\""," ").Replace("'"," "); 
                                         bbsurl = htmtltle.GetAttribute("href"); 
                                    } 
                                    break; 
                                case 2: 
                                    HtmlElement htmauthor = htmtd.GetElementsByTagName("a")[0]; 
                                    bbsauthor = htmauthor.InnerText; 
                                    authorlink = htmauthor.GetAttribute("href"); 
                                    break; 
                                case 3: 
                                    bbsview = int.Parse(htmtd.InnerText); 
                                    break; 
                                case 4: 
                                    bbsreply = int.Parse(htmtd.InnerText); 
                                    break; 
                                case 5: 
                                    bbsuptime = htmtd.InnerText; 
                                    break; 
                            } 
                            j++; 
                        } 
但是在其它BSS,比如拿北邮人论坛来说,一条信息的格式是这样的: 
origin = new Post(7081, 'tang', '2009-04-25 23:00:27', ' '); 
    lastreply = new Post(7086, 'nonsense', '2009-04-26 00:04:56', ' '); 
    writepost(7, '怎样读取javascript里的数据到C#中? ', 5, origin, lastreply, 1, 0); 
现在我想解析出主题,作者等内容,Microsoft.JScript有没有跟在解析HTML一样的类似于htmtd.GetElementsByTagName("a")的方法?