<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
padding: 0;
margin:0;
}
.wrap{
width:700px;
height:500px;
background:url(https:
background-size:cover;
margin:150px auto;
text-align:center;
}
textarea{
opacity: 0.8;
border:2px solid #000;
width:360px;
height:130px;
background:#fff;
border-radius:8px;
resize:none;
margin-top:118px;
padding:5%;
box-sizing:border-box;
font-size:16px;
}
button{
display: block;
width:100px;
height:45px;
border:2px solid #fff;
background:blue;
font-size:16px;
line-height:30px;
font-family:"微软雅黑";
border-radius:12px;
color:white;
margin-left:430px;
}
#list{
width:360px;
margin:17px 0 0 170px;
}
ul{
list-style: none;
}
li{
height: 40px;
margin-bottom:12px;
background-color:yellowgreen;
border-radius:12px;
color:white;
padding-left:20px;
box-sizing:border-box;
line-height:40px;
text-align:left;
}
</style>
</head>
<body>
<div class="wrap">
<textarea id="text"></textarea>
<button id="tj">提交留言</button>
<ul id="list"></ul>
</div>
<script>
var text = document.getElementById("text");
var tj = document.getElementById("tj");
var list = document.getElementById("list");
tj.onclick = function(){
console.log(text.value);
var txt = text.value;
list.innerHTML = list.innerHTML + "<li>" + txt + "</li>";
};
</script>
</body>
</html>