亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

在線聊天功能的實現(xiàn)

original 2019-03-08 17:05:59 303
abstrait:<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv=&

<!DOCTYPE html>


<html>

<head>


<meta charset="UTF-8">


<meta name="viewport" content="width=device-width, initial-scale=1.0">


<meta http-equiv="X-UA-Compatible" content="ie=edge">


<title>Chat_Room_Case</title>


<style>

* {


padding: 0;


margin: 0;


}




ul li {


list-style: none;


margin-left: -200px;


padding: 4px;


}


.container {


margin: 0 auto;


text-align: center;


margin: 15px;


}



.container .chatbox {


margin: 0 auto;


width: 300px;


height: 400px;


border: 1px solid #ccc;


}




.container .chatbox span {


display: block;


width: 100%;


color: #fff;


background: #5c28d4;


}




.container .btn {


margin: 0 auto;


width: 120px;


height: 45px;


color: #fff;


letter-spacing: 12px;


background: rgb(26, 121, 199);


border-radius: 5px;


text-align: center;




}




.container .msg {


height: 40px;


border: 1px solid #ddd;


padding: 0 5px;




}

</style>


</head>




<body>


<div class="container">


<div id="cbox" class="chatbox">


<span style="font-size:20px;">Welcome to this Chatroom</span>


<hr>


<ul>


<li></li>


</ul>


</div>


<div>


<input type="text" placeholder="歡迎來到本聊天室......."class="msg"> <button class="btn">發(fā)送</button></div>


</div>


<script>


let input = document.getElementsByClassName('msg')[0];


let ul = document.getElementsByTagName('ul')[0];


let button = document.getElementsByClassName('btn')[0];


button.onclick = function () {


let li = document.createElement('li');


li.innerHTML = input.value;


ul.appendChild(li);


input.value = '';


}


</script>


</body>


</html>


Professeur correcteur:韋小寶Temps de correction:2019-03-09 09:11:43
Résumé du professeur:寫的還算是很不錯的 沒事要記得多去練習(xí)練習(xí)哦 可以考慮使用jQuery來把這個項目改寫一下

Notes de version

Entrées populaires