2 Star 0 Fork 2

tangze/operatorWeb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
chat_demo.html 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
tangze 提交于 2024-01-26 19:24 . 聊天页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chat Box</title>
<style>
.chat-container {
width: 100%;
position: absolute;
bottom: 0;
display: flex;
flex-direction: column;
align-items: flex-end;
}
.chat-message {
max-width: 80%;
border: 1px solid #ddd;
padding: 10px;
margin-bottom: 5px;
}
.chat-input {
width: 80%;
padding: 10px;
margin-top: 5px;
}
.chat-box {
height: 200px;
overflow-y: scroll;
}
</style>
</head>
<body>
<div class="chat-container">
<div class="chat-box">
<!-- Chat messages will be added here -->
</div>
<input type="text" class="chat-input" placeholder="Type your message here...">
</div>
<script>
// JavaScript to add messages to the chat box
function addMessage(message) {
const chatBox = document.querySelector('.chat-box');
const messageElement = document.createElement('div');
messageElement.classList.add('chat-message');
messageElement.textContent = message;
chatBox.appendChild(messageElement);
// Scroll to the bottom of the chat box
chatBox.scrollTop = chatBox.scrollHeight;
}
// Example usage
addMessage('Hello, how are you?');
addMessage('I am doing great, thanks!');
addMessage('111');
addMessage('222');
addMessage('333');
addMessage('444');
addMessage('555');
addMessage('666');
addMessage('777');
addMessage('888');
addMessage('999');
addMessage('000');
addMessage('10');
addMessage('11');
addMessage('12');
addMessage('13');
addMessage('14');
addMessage('15');
addMessage('16');
addMessage('17');
addMessage('18');
addMessage('19');
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/woos/operator-web.git
[email protected]:woos/operator-web.git
woos
operator-web
operatorWeb
master

搜索帮助