代码:
点击(此处)折叠或打开
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>jQ的微博发布</title>
- <link rel="stylesheet" href="css/1.css" />
- <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="js/1.js"></script>
- </head>
- <body>
-
- <div id="bigbox">
- <div id="enterbox">
- <h2>有什么想对博主说的</h2>
- <p>最多不能超过2000字</p>
- <textarea name="" id="userinput" cols="30" rows="10" value=""></textarea>
- <button id="button">提交</button>
- </div>
- <div id="downbox">
- <!--在js里面创建的思路如下代码-->
- <!--<div id="replaybox">
- <div id="picture"></div>
- <div id="word">
- <div id="del">
- <textarea name="" id="useraccpet" cols="30" rows="10" value="">adfadfad</textarea>
- <button id="delbutton" value="删除">删除</button>
- </div>
- </div>
- </div>-->
- </div>
-
- </div>
- </body>
- </html>
点击(此处)折叠或打开
- *{
- margin: 0;
- padding: 0;
- }
- #enterbox{
- width: 1000px;
- height: 400px;
- margin: 0 auto;
- padding:50px;
- border: 1px solid gainsboro;
- margin-top: 40px;
- }
- #enterbox textarea{
- resize: none;
- width: 1020px;
- height: 300px;
- margin-top: 50px;
- border: 1px solid gainsboro;
- font-size: 16px;
- color: grey;
- }
- #enterbox p{
- margin-bottom: -20px;
- float: right;
- color:red;
- }
- h2{
- margin-bottom: -20px;
- color:gray;
- }
- #enterbox button{
- float:right;
- width: 100px;
- height: 40px;
- margin-top: 20px;
- font-size: 25px;
- color:gray;
- }
- #replaybox{
- width: 1070px;
- height: 200px;
- margin:0 auto;
- padding: 20px;
- margin-top: 40px;
- border:1px solid gainsboro;
- background-repeat: no-repeat;
-
- }
- #replaybox p{
- float: left;
- margin-left: 50px;
-
- }
- #picture{
- width: 200px;
- height: 200px;
-
- background: url(img/1.jpg);
- float: left;
- }
- #word{
- width: 815px;
- height: 200px;
- float: left;
- margin-left: 40px;
- border: 0px solid gainsboro;
- }
- #delbutton{
- float:right;
- width: 100px;
- height: 40px;
- margin-top: 20px;
- font-size: 10px;
- color:gray;
- margin-right: 20px;
- margin-top:150px;
- }
- #word textarea{
- resize: none;
- width: 640px;
- height: 120px;
- padding: 5px;
- margin: 20px 0 0 20px;
- font-size: 16px;
- border:1px solid gainsboro;
- background: white;
-
- }
- span{
- font-size: 20px;
- color:gray;
-
- }
点击(此处)折叠或打开
- window.onload = function(){
-
- $(function(){
-
- $("button").click(function(){
-
- var b = $("#userinput").val();
-
- b = b.replace(/(\s*)|(\s*$)/g,"");
- console.log(b);
- if( b == ""){
- alert("内容不能为空");
- // window.location.reload();
- }else{
- $("#downbox").prepend(("//////// ////
- $("#useraccpet").val(b);
- $("#userinput").val(null);
-
-
-
-
- $("#delbutton").click(function(){
-
- $(this).parents("#replaybox").slideUp(1000);
- })
-
-
- }
- })
- })
-
-
- }