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

模仿新浪微博换一换

PHP中文网
PHP中文网Original
2016-05-25 17:09:592127browse

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();
?>

                   


                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn