我想实现的功能是 首页的内容改变了,增加了几个html的链接
使用JavaScript查找出 增加了哪些 html链接,并且把这些链接在新的页面打开。不知道有人帮我没? 

解决方案 »

  1.   

    当然有原始数据了一个首页,1.html  更新后 变成2.html,里面多了一些 href的链接,就是想如何 得到这些链接并且在新的页面或者标签中打开那个页面
      

  2.   

    这些链接要是有id或者class之类的属性就好做了。
      

  3.   

    有个 span的id属性。。有没有达人吖??
    代码段如下,是一个论坛,有一个新帖子,代码是这样的:
     <em>[<a href="forumdisplay.php?fid=14&amp;filter=type&amp;typeid=26">随笔</a>]</em><span id="thread_77341"><a href="thread-77341-1-1.html">问个问题。</a></span>
    <img src="images/attachicons/image_s.gif" alt="图片附件" class="attach" />
    <span class="threadpages">&nbsp;... <a href="thread-77341-2-1.html">2</a> <a href="thread-77341-3-1.html">3</a> <a href="thread-77341-4-1.html">4</a> <a href="thread-77341-5-1.html">5</a> <a href="thread-77341-6-1.html">6</a>  .. <a href="thread-77341-8-1.html">8</a> </span>
    <a href="redirect.php?tid=77341&amp;goto=newpost#newpost" class="new">New</a>
    </th>
    <td class="author">
    <cite>
    <a href="space-uid-79985.html">449553312</a>
    </cite>
    <em>2009-7-27</em>
    </td>
    <td class="nums"><strong>72</strong>/<em>287</em></td>
    <td class="lastpost">
    <cite><a href="space-username-zt871004.html">zt871004</a></cite>
    <em><a href="redirect.php?tid=77341&amp;goto=lastpost#lastpost"><span title="2009-7-28 00:48">4&nbsp;分钟前</span></a></em>
    </td>
    </tr>
    </tbody><tbody id="normalthread_77262" >
    <tr>
    <td class="folder">
    <a href="thread-77262-1-1.html" title="新窗口打开" target="_blank">
    <img src="images/default/folder_new.gif" alt="new" />
    </a>
    </td>
    <td class="icon">
    <img src="images/icons/icon3.gif" alt="Icon21" class="icon" /></td>
    <th class="subject new">
    <label>
      

  4.   

    分析一下这个问题,你需要发现的是数据的更改,但是客户端里面实际包含了数据和表现代码两种东西,所以你必须把数据从表现代码中抽取出来然后才能比较。且不说效率,怎么抽取数据就够忙活一阵了。比如上面那堆东西里面哪个是你想抽取的数据?标题吗?标题相同了又应该怎么办?
    服务器端就不一样了,数据都在数据库里,哪个是新数据查出来很容易(比如多数表都会有自增的ID,ID大于最后一次那个ID的记录都可以认为是新的)
    所以这应该就是服务器端做的事情,硬要放客户端来做的话纯属自找麻烦。强烈建议不要往这个思路上走。