首页 >php教程 >PHP源码 >模仿新浪微博换一换

模仿新浪微博换一换

PHP中文网
PHP中文网原创
2016-05-25 17:09:592111浏览

1. [代码]change.js    

//change.js
$(document).ready(function(){
	var url = "change_doc.php";
    showFirstPage(url);			
});
function showFirstPage(serverUrl){
	var url = serverUrl+"?fuckie="+Math.random();
    $.get( url,  function(data){
        $(".change_doc").html(data);
    }
    ); 
}


2. [代码]index.php

//index.php
<script type="text/javascript" src="js_change/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js_change/change.js" ></script>


<p class="change_doc"></p>


3. [代码]change_doc.php   

<?php
include &#39;connect.php&#39;;
	
	function change_doc() {

        $Row = @mysql_query("SELECT * FROM countries  ORDER BY rand() DESC LIMIT 3");
        $Html = "";
		$Html .= &#39;<p class="right_r_c">&#39;;
        $Html .= &#39;    <p class="right_r_c_t1" ><span class="right c_73a6eb right_c_h"><a onclick="showFirstPage(\&#39;change_doc.php\&#39;); " href="javascript: void(0);">换一换</a></span>&#39;;
        $Html .= &#39;    </p>&#39;;
        $Html .= &#39;    <p class="clear"></p>&#39;;
        $Html .= &#39;    <p id="change_one">&#39;;
        while ($mesList = @mysql_fetch_array($Row)) {
			$Html .= &#39;      <p class="right_c_c">&#39;;
			$Html .= &#39;        <p><a href="#">&#39; . $mesList[&#39;value&#39;] . &#39;</a></p>&#39;;
			$Html .= &#39;      </p>&#39;;
		}
        $Html .= &#39;    </p>&#39;;
        $Html .= &#39;</p>&#39;;
        
        return $Html;
    }

	echo change_doc();
?>

                   


                   

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn