国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > AJAX > 正文

Ajax與mysql數(shù)據(jù)交互制作留言板功能(全)

2024-09-01 08:27:28
字體:
供稿:網(wǎng)友

最近自己做了一個小demo,實現(xiàn)了Ajax與MySQL的數(shù)據(jù)交互,js部分用的是jq,后臺用的是php,數(shù)據(jù)庫是mysql,過時間再來一個node+mongodb版的。

關(guān)于mysql的使用和安裝,就不多講了,自行百度xampp,Apache服務器和mysql數(shù)據(jù)庫集成,非常好用。

首先打開服務器和數(shù)據(jù)庫,我這里先建立了一個“eleven”的數(shù)據(jù)庫,下面建立了一個叫做microblog的表(請注意:我這里使用的是高版本的mysql,里面php鏈接數(shù)據(jù)庫的方法使用的都是mysqli_  如果版本過低,請使用mysql_ 方法,自行修改代碼)
以下是代碼部分:

html頁面和js部分:

<!DOCTYPE html> <html>   <head>     <meta charset="UTF-8">     <title>微博留言板</title>     <style type="text/css">       *{         margin: 0;         padding: 0;       }       #box{         width: 600px;         /*height: 500px;*/         border: 2px solid rgb(85,85,85);         border-radius: 15px;         margin: 50px auto;         padding: 20px 10px 15px;         background-color: rgb(85,85,85);       }       #content{         display: block;         resize: none;         width: 550px;         height: 200px;         margin: 0 auto;         border: 2px solid rgb(225,225,225);         border-radius: 10px;         text-align: center;         font-size: 30px;         background-color: rgb(225,225,225);       }       #content:focus{         outline: none;         border: 2px solid rgb(225,225,225);         box-shadow: 0 0 15px rgb(225,225,225);       }       #btn{         border: 2px solid rgb(255,204,0);         width: 80px;         height: 40px;         border-radius: 5px;         margin-top: 30px;         font-size: 17px;         cursor: pointer;         outline: none;         background-color: rgb(255,204,0);       }              .list{         list-style: none;         background-color: rgb(249,249,249);         margin-top: 20px;       }       .list>li{         padding: 20px 10px 10px;         border-bottom: 2px solid rgb(68,68,68);         font-size: 20px;         color: rgb(200,214,225);         position: relative;         word-break: break-word;         word-wrap: break-word;         background-color: rgb(85,85,85);                }       .list>li>.control{         position: absolute;         bottom: 3px;         right: 5px;         font-size: 14px;       }       .list>li>p{         margin-bottom: 25px;       }       .control span,.control em{         display: inline-block;         margin-right: 15px;       }       .control em{         color: darkblue;         cursor: pointer;       }       a{         text-decoration: none;         color: darkred;       }       #page>a{         display:inline-block;         width: 40px;         height: 30px;         margin-top: 10px;         text-align: center;         line-height: 30px;         font-size: 20px;         border-radius: 5px;         color: white;         background-color: rgb(51,21,70);       }       #head{         color: rgb(200,214,225);         font-size: 30px;         height: 50px;         border-bottom: 2px solid rgb(68,68,68);         margin-bottom: 20px;       }     </style>   </head>   <body>     <div id="box">       <div id="head">         留言板       </div>       <div id="fill_in">         <textarea id="content"></textarea>         <button id="btn">提交留言</button>       </div>       <!--留言列表-->       <div id="message_text">         <ul class="list">         </ul>       </div>       <!--分頁-->       <div id="page">         <a href="javasript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" >1</a>         <a href="javasript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" >2</a>       </div>     </div>   </body>   <script src="Jq/jquery-3.1.1.min.js"> </html>             
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 高青县| 南皮县| 赤壁市| 二连浩特市| 永嘉县| 布拖县| 神农架林区| 正宁县| 洛隆县| 嘉定区| 桂林市| 油尖旺区| 满洲里市| 隆德县| 交城县| 郸城县| 百色市| 潢川县| 胶南市| 巴楚县| 九龙县| 波密县| 沅江市| 庐江县| 伊宁市| 安丘市| 武穴市| 临漳县| 清丰县| 通道| 中方县| 喜德县| 新化县| 宜阳县| 古丈县| 屯门区| 凌海市| 翁牛特旗| 济阳县| 张家川| 北碚区|