我把新闻生成html了  但是在新闻左测有个新闻搜索  我是反新闻搜索的内容  做成aspx的  然后再的html中调用 方法<iframe frameBorder="0" height="140" width="240" scrolling='no' src="../../inc/infoSearch.aspx"></iframe>  但是在打开的时候  新闻内容都出来了  那个iframe 还没有出来  这样还不如不生成html  有没有什么办法  在html中更快的调用aspx页面

解决方案 »

  1.   

    使用XMLHttpRequest直接把aspx读过来,或者把要查询的数据通过XMLHttpRequest传给后台aspx处理后,在读会来也可.不过都麻烦一点点...
      

  2.   

    那个搜索页面很简单  但是在加载的时候 至少3秒   <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                <tr>
                                    <td><img src="../images/info2.jpg" /></td>
                                </tr>
                                <tr>
                                    <td align="center" height="25" >
                                        文章分类:<asp:DropDownList ID="ddlType" runat="server">
                                        </asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td align="center" height="25" >
                                        搜索类别:<asp:DropDownList ID="ddlKind" runat="server">
                                        <asp:ListItem Value="0">文章题目</asp:ListItem>
                                        <asp:ListItem Value="1">文章内容</asp:ListItem>
                                        </asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td align="center" height="25" >
                                        关 键 词:<asp:TextBox ID="txtKeyWord" CssClass="text_form" Width="80" MaxLength="20" runat="server"></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td align="center" height="25" >
                                        <asp:ImageButton ID="imgSearch" ImageUrl="../images/searchs.gif" runat="server" OnClick="imgSearch_Click" />
                                        </td>
                                </tr>
                            </table>
      

  3.   

    如果你在aspx中放一个iframe来装载html页面,你很可能反而会看到html页面滞后显示。所以虽然你应该为aspx进行优化,例如应该缓存,但是大概并不能改变显示的先后次序。
      

  4.   

    XMLHttpRequest  有没有例子啊
      

  5.   

    问题解决了  直接打印出htmlDataTable dt = InfoDAO.getTpyeList().Tables[0];
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" >");
            stringBuilder.Append("<tr><td><img src=\"../../images/info2.jpg\" /></td></tr>");
            stringBuilder.Append("<tr><td align=\"center\" height=\"25\" >文章分类:<select name=\"ddlType\" id=\"ddlType\">");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                stringBuilder.Append("<option value=" + dt.Rows[i]["ID"].ToString() + ">" + dt.Rows[i]["name"].ToString() + "</option>");
            }
            stringBuilder.Append("</select></td></tr><tr>");
            stringBuilder.Append("<td align=\"center\" height=\"25\" >搜索类别:<select name=\"ddlKind\" id=\"ddlKind\"><option value=\"0\">文章题目</option><option value=\"1\">文章内容</option></select></td>");
            stringBuilder.Append("</tr><tr><td align=\"center\" height=\"25\" >关 键 词:<input name=\"txtKeyWord\" type=\"tex\" maxlength=\"20\" id=\"txtKeyWord\" class=\"text_form\" style=\"width:80px;\" /></td></tr><tr><td align=\"center\" height=\"25\" ><input type=\"image\" name=\"imgSearch\" id=\"imgSearch\" onclick=\"openSearch();\" src=\"../../images/searchs.gif\" style=\"border-width:0px;\" /></td></tr></table>");