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

模仿新浪微博换一换

PHP中文网
Release: 2016-05-25 17:09:59
Original
2116 people have browsed it

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);
    }
    ); 
}
Copy after login


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>
Copy after login


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

                   


                   

Related labels:
php
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template