You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
6 months ago
|
<!DOCTYPE html>
|
||
|
<head>
|
||
|
<meta charset = "utf-8" />
|
||
|
<style>
|
||
|
body{
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
align-items: center;
|
||
|
background-color: rgb(117, 113, 113);
|
||
|
color: white;
|
||
|
}
|
||
|
#main{
|
||
|
flex: 1;
|
||
|
width: 60%;
|
||
|
}
|
||
|
#typing{
|
||
|
flex: 1;
|
||
|
width: 60%;
|
||
|
height: 20vh;
|
||
|
border: red;
|
||
|
font-size:xx-large;
|
||
|
}
|
||
|
#commend{
|
||
|
flex: 1;
|
||
|
width: 80%;
|
||
|
}
|
||
|
#btn{
|
||
|
background-color: red;
|
||
|
}
|
||
|
p{
|
||
|
background-color:black;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id="main">
|
||
|
<h1>评论区</h1><hr>
|
||
|
<textarea id="typing">输入文字</textarea>
|
||
|
<button id="btn">发送评论</button>
|
||
|
<div id="commend"></div>
|
||
|
</div>
|
||
|
</body>
|
||
|
|
||
|
<script>
|
||
|
document.getElementById("btn").onclick=function(){send()};
|
||
|
function send(){
|
||
|
var g=new Date();
|
||
|
var value= document.getElementById("typing").value;
|
||
|
var p= document.createElement("p");
|
||
|
p.innerHTML="用户:"+value+'<hr>'+g.toUTCString();
|
||
|
document.getElementById("commend").prepend(p);
|
||
|
}
|
||
|
</script>
|
||
|
</html>
|