如果就以这个新闻链接为例子,我想获取心情投票的结果,该如何做呢?
http://www.chinanews.com.cn/gn/news/2009/03-17/1606008.shtml

解决方案 »

  1.   

    用jquery给你写个例子吧L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript" src="js/jq.js"></script>
        <script type="text/javascript">
        function alertdata(data)
        {
            var temp= data;
            alert(temp);
        }
        $.ajax({
    type: "get",
    url: "http://www.cnblogs.com/rss",
    beforeSend: function(XMLHttpRequest){
    //ShowLoading();
    },
    success: function(data, textStatus){
        alertdata(data);
    $(".ajax.ajaxResult").html("");
    $("item",data).each(function(i, domEle){
    $(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");
    });
    },
    complete: function(XMLHttpRequest, textStatus){
    //HideLoading();
    },
    error: function(){
    //请求出错处理
    }
    });
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="roteResult">
        <p  class="ajax ajaxResult">
        
        </p>
        
        </div>
        </form>
    </body>
    </html>
      

  2.   


      一个经常要用到 ajax 的地方!其它的不用说了!~
      

  3.   

    require 'net/http'
    require 'iconv'
    http=Net::HTTP.new 'mood.chinanews.com.cn' #事实上的投票后会重新访问服务器
    res,data=http.get '/data/2009/03/17/1606008.shtml' #从此对应地址取得投票结果v=data.scan(/\t(\d+)/)  #然后正则分析,得到投票结果
    s=data.scan   /<td width="70" height="20" align="center">(.*)</ #和对应的选项
    #打印投票结果 ,将gbk转为utf8输出
    v.each_index {|i| print Iconv.conv('utf8','GBK',s[i][0]),':',v[i][0],"\r\n"}