感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<textarea id="text_box"></textarea>
<button id="btn">留言</button>
<hr>
<ul id="msg_list">
</ul>
xxxxxxxxxx
window.onload = function(){
var list = document.getElementById("msg_list");
var btn = document.getElementById("btn");
var text_box = document.getElementById("text_box");
btn.onclick = function(){
var content = text_box.value;
var li = document.createElement("li");
li.innerHTML = content;
if(list.children[0]){
list.insertBefore(li, list.children[0]);
}else{
list.appendChild(li)
}
li.style.opacity = "0"
var liHeight = li.offsetHeight - 11;
li.style.height = "0";
setTimeout(function(){
li.style.height = liHeight + "px";
li.style.opacity = "1.0";
},10);
ul{
margin:0;
width:250px;
//border:solid 1px #999999;
padding:10px;
li{
overflow:hidden;
transition:all 0.3s linear;
padding:5px;
border-bottom:dotted 1px #999999;
word-break:break-all;
textarea{
resize:none;
height:80px;