网站:http://ping.chinaz.com/动态加载新增的<ul><li>.....</li><ul>,这个网站是通过iframe来实现的,但具体如何实现原理,我没找到。请教这个如何用js实现?

解决方案 »

  1.   

    <script>parent.document.getElementById('detail').innerHTML+='<ul><li>1</li><li>云南昆明[电信]</li><li><a href="http://ip.chinaz.com/?IP=112.117.216.47">112.117.216.47</a></li><li style="">1毫秒</li><li>58</li><li><a href="http://www.yunnanidc.net" target=_blank>云南数据港</a></li></ul>';</script>
      

  2.   

    根据http协议,服务端会把所有的结果一次返回,不会像这个特效一样延时返回,所以我觉得延时的效果是用js来开发的。
      

  3.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="Test_test" %>
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <% ping(); %>
        </div>
        </form>
    </body>
    </html>using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;public partial class Test_test : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            
        }    protected void ping() {
            for (int i = 0; i < 10; i++) {
                Response.Write(i + "<br/>");
                Response.Flush();
                System.Threading.Thread.Sleep(500);
            }
        }
    }这个是用.net 模拟一个例子
      

  4.   

    ajax+setTimeout/setInterval定时获取服务器端返回的ping值就行了也可以使用长连接[服务器推]来实现,Streaming AJAX
      

  5.   

    谢谢Free_Wind22  的提示,按你的思路搞定了。