Twitter是世界上最流行的互聯(lián)網(wǎng)服務(wù),它為用戶提供微博客服務(wù),界面簡(jiǎn)潔美觀。本文中,我們將使用jqueyr建立一個(gè)類twitter站點(diǎn)。你將學(xué)習(xí)jquery一些的技巧,以及如何一起使用PHP和mysql。你會(huì)喜歡的。
介紹
通過(guò)twitter,用戶可以任何時(shí)候發(fā)布他們?cè)谧鍪裁?,twitter會(huì)及時(shí)顯示這些信息。從而,每個(gè)朋友都能同時(shí)知道你在做什么。twitter主頁(yè)如下:

在本教程中,我們將實(shí)現(xiàn)類似twitter的界面,并且會(huì)使用PHP實(shí)現(xiàn)信息發(fā)布功能,數(shù)據(jù)會(huì)保存到mysql數(shù)據(jù)庫(kù)中。

第一步:界面布局
界面布局和twitter.com非常相似。本例中,只會(huì)顯示消息文本框和消息顯示區(qū)域,如上圖所示。html代碼如下:
以下為引用的內(nèi)容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery Tutorial: Twitter-Like Site by Ji Guofei</title> </head> <body> <div id="title"> <h1><a href="#"><img _fcksavedurl=""#"><img" _fcksavedurl=""#"><img" _fcksavedurl=""#"><img" _fcksavedurl=""#"><img" src="twilike.png" alt="Twitter-Like Site" ></a></h1> </div> <div id="arrow"><img src="images/arrow-up.gif" alt="arrow"/></div> <div id="container"> <form id="commentForm"> <fieldset> <legend><span id="counter"></span> Characters</legend> <textarea id="message" name="message" ></textarea> <input name="btnSign" class="submit" type="submit" id="submit" value="Update" /> </fieldset> </form> <div id="messagewindow"> This area will be used to display the messages. </div> </div> <div id="footer"> <div id="footer_a"> This is just a example to learn jQuery. </div> </div> </body> </html> |
將代碼保存為index.php,我們將向文件中添加一些PHP代碼以便顯示消息。
共5頁(yè)上一頁(yè)12345下一頁(yè)