首页 > 代码库 > 留言板效果,爱的告白

留言板效果,爱的告白

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #2b7ec3 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; min-height: 36.0px } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #d74200 } p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #289c97 } p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #060606 } p.p6 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #4a8a01 } p.p7 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #929151; min-height: 36.0px } p.p8 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #d16400 } p.p9 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #929151 } p.p10 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #4f5d66 } p.p11 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #a5b2b9 } p.p12 { margin: 0.0px 0.0px 0.0px 0.0px; font: 31.0px Consolas; color: #4663cc } span.s1 { color: #4f5d66 } span.s2 { color: #2b7ec3 } span.s3 { color: #48565d } span.s4 { color: #289c97 } span.s5 { color: #d74200 } span.s6 { color: #000000 } span.s7 { color: #060606 } span.s8 { color: #929151 } span.s9 { color: #4a8a01 } span.s10 { color: #ad42ef } span.s11 { color: #698906 } span.s12 { color: #d16400 } span.s13 { color: #4663cc } span.s14 { color: #e48b00 } span.s15 { color: #b58a00 } span.Apple-tab-span { white-space: pre }</style>

<!DOCTYPE html>

<html>

 

<head>

<meta charset="UTF-8">

<title></title>

<style type="text/css">

#box {

border: 2px solid deeppink;

width: 1000px;

margin: 10px auto;

padding: 10px;

background-color: pink;

color: white;

font-size: 20px;

}

 

#title {

display: flex;

}

 

#titleFont {

line-height: 50px;

}

 

#titleSpace {

height: 50px;

width: 900px;

border: 1px solid deeppink;

outline: deeppink;

font-size: 20px;

color: deepskyblue;

}

 

#content {

display: flex;

margin-top: 20px;

}

 

#contentspace {

border: 1px solid deeppink;

outline: deeppink;

font-size: 20px;

height: 300px;

width: 900px;

color: seagreen;

}

 

#submit {

height: 30px;

width: 100px;

border: 1px solid yellow;

color: crimson;

background-color: white;

font-size: 20px;

outline: none;

cursor: pointer;

margin-left: 60px;

margin-top: 20px;

}

 

#text {

font-size: 25px;

}

 

#show {

margin-left: 55px;

margin-top: 20px;

}

 

li,

ul {

margin: 0;

padding: 0;

list-style-type: none;

}

 

li {

height: 50%;

line-height: 40px;

text-indent: 20px;

}

 

ul {

width: 900px;

}

</style>

</head>

 

<body>

<div id="box">

<div id="title">

<div id="titleFont">标题:</div>

<input type="text" id="titleSpace" />

</div>

<div id="content">

<div id="contentFont">

内容:

</div>

<textarea id="contentspace"></textarea>

 

</div>

<input type="button" id="submit" value="提交" />

<div id="show">

<div id="text">

爱的告白

</div>

 

</div>

</div>

</body>

<script type="text/javascript" src="js/tween(1).js">

</script>

<script type="text/javascript">

var btn = document.getElementById("submit");

var tSpace = document.getElementById("titleSpace");

var cSpace = document.getElementById("contentspace");

var show = document.getElementById("show");

var timer = null;

//赋点击事件

btn.onclick = function() {

var str1 = tSpace.value;

var str2 = cSpace.value;

//判断是否为空

if(str1.length == 0 || str2.length == 0) {

alert("爱的表白怎么能少了文字的点缀呢?")

} else {

var ul = document.createElement("ul");

ul.style.marginTop = 10 + "px";

ulHeight(ul);

var liTop = document.createElement("li");

liTop.style.backgroundColor = "cadetblue";

liTop.innerHTML = "??" + tSpace.value + "??";

ul.appendChild(liTop);

var liBot = document.createElement("li");

liBot.style.backgroundColor = "seagreen";

liBot.innerHTML = "??" + cSpace.value + "??";

liBot.style.position = "relative";

var a = document.createElement("a");

a.href = "#"

a.innerHTML = "删除";

a.style.position = "absolute";

a.style.right = 10 + "px";

a.onclick = function() {

 

ul.remove();

}

liBot.appendChild(a);

 

ul.appendChild(liBot);

show.appendChild(ul);

 

}

 

}

//产生高度的函数

function ulHeight(obj) {

 

var t = 0;

var d = 30;

var b = 0;

var c = 80;

clearInterval(timer);

timer = setInterval(function() {

t++;

if(t >= d) {

clearInterval(timer);

}

 

obj.style.height = Tween.Bounce.easeOut(t, b, c, d) + "px";

 

}, 30)

}

</script>

 

</html>

留言板效果,爱的告白