伪留言系统

简单弱智没什么卵用的

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,
    minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="css/main.css"/>
    <title>投诉建议</title>
    <!--<script src="lib/angular-1.3.0.js"></script>-->
    <script src="lib/jquery-2.1.4.min.js"></script>
    <style>
        body{
            font-family: "Microsoft YaHei" , "Open Sans", sans-serif;
            margin: 0;
            padding: 0;
        }
        .feedbackmsg textarea{
            background-color: #e2e2e2;
        }
        .feedbackcommit{
            margin: 5px 10px;
            text-align: right;
        }
        .feedbackcommit img{
            width: 100px;
        }
        #commentlist{
            margin: 5px 10px;
        }
        #commentlist>div{
            margin-bottom: 20px;
        }
        #commentlist .user{
            font-weight: 600;
        }
        #commentlist .comment{
            color:#bdbdbd;
        }
        #submitcmt{
            height: 44px;
            width: 86px;
            border-radius: 4px;
            color: #ffffff;
            font-size: 14px;
            font-weight: 700;
            background-color: #003eff;
        }
    </style>
</head>
<body>
    <div class="feedbackmsg">
        <textarea id="commentmsg" style=" width: 98%;height: 200px;resize: none"></textarea>
    </div>

    <div class="feedbackcommit">
        <!--<img src="img/confirm.png" id="submitcmt" alt=""/>-->
        <input type="button" id="submitcmt" value="提交留言"/>
    </div>
    <div id="commentlist">
        <div>
            <span class="user">游客89757</span>
            <span class="comment">景色很美,上午睁开眼就被眼前的景色迷住了</span>
        </div>
        <div>
            <span class="user">游客12306</span>
            <span class="comment">酒店很不错,前台也很热情</span>
        </div>
        <div>
            <span class="user">游客12345</span>
            <span class="comment">老婆孩子都很满意,下次一定还光顾这家酒店</span>
        </div>
    </div>
</body>
</html>

  js代码

    $(document).ready(function(){
        $("#submitcmt").click(function(){
            var commentmessage=$("#commentmsg").val();
            var username="游客"+Math.random().toString().slice(3,8);
            var comHtml="<div>"+
                            "<span class='user'>"+username+"</span>"+
                            " <span class='comment'>"+commentmessage+"</span>"+
                            "</div>";
            if(commentmessage){
                $("#commentlist").prepend(comHtml);
            }
            $("#commentmsg")[0].value="";
        });
    })

  

posted on 2016-08-25 13:41  carlyin  阅读(132)  评论(0)    收藏  举报

导航