本帖最后由 kj8629 于 2012-04-09 13:20:18 编辑

解决方案 »

  1.   

    你先将所有信息查出来,比如先显示2条,将其他的放在隐藏的DIV中,点击查看更多列表的时候显示那个隐藏层
      

  2.   

    用smarty框架做多好啊,<div class="feed_div">
    {{php}}$rmidx=0;{{/php}}
    {{foreach from=$list item=val}}
      <div {{php}} if ( $rmidx >= 2 ) {echo 'class="news_list" style="display:none"';} {{/php}}>
      <div class="topic"><a href={{val.url}} target="_blank">这里是标题</a></div>
      <div class="desc"><p>{{$val,value}}</p>
      </div>
      </div>
      {{php}}$rmidx++;{{/php}}
    {{/foreach}}
    </div>
     <div><span id="news">查看更多列表</span></div>
      

  3.   


    <?php
    if(isset($_GET['info'])){
      $start=0;
      $perpage=2;
      $sql="Select * from article limit LIMIT {$start} , {$perpage};
      $list[]= array();
      print_r($list);
    }
    ?><a href="javascript:;" onclick="morelist();" >查看更多列表</a>
    <div id="tip1">......</div><script>
      var xmlHttp; //定义全局变量 function createXMLHttpRequest() {
    //表示当前浏览器不是ie,如ns,firefox
    if(window.XMLHttpRequest) {
    xmlHttp = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    } function morelist(Obj){
    createXMLHttpRequest();
    url = "/path/xxx.php?info="+Obj+"&ran="+Math.random();
    method = "GET";
    xmlHttp.open(method,url,true);
    xmlHttp.onreadystatechange = show;
    xmlHttp.send(null);
    } function show(){
    if (xmlHttp.readyState == 4){
    if (xmlHttp.status == 200){
    var text = xmlHttp.responseText;
    //alert("text-->>"+text);
    Obj = document.getElementById("tip1");
    Obj.innerHTML = text;
    }else {
    alert("response error code:"+xmlHttp.status); //输出响应出错的代码
    }
    }
    }
    </script>
      

  4.   

    可以写成jquery的吗?谢谢
      

  5.   

    我擦,直接将<script>……</script>之间的内容放到页面不就行了。
    好吧,服了:<a id="more" href="javascript:;" >查看更多列表</a>
    <div id="tip1">......</div><script>
    $(function(){
     $("#more").click(function () {
      $.ajax({
       type: "POST",
       url: "xxx.php",
       data: "info="+Math.random(),
       success: function(msg){
         $("tip1").html(msg);
       }
      });
     }
    });
    </script>jQuery参考手册-Ajax事件:http://download.csdn.net/detail/dmtnewtons/4126497
      

  6.   

    谢谢啊。。我试试先。thank you