<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Сайт по ифнорматике </title>
<link rel="stylesheet" href="/css/Main.css">
<meta name="viewport" content="width=1100px, initial-scale=1.0">
</head>
<body>
<header>
<div class = "line">
<div class = "head">
<nav>
<ul class = "menu">
<li>
<a href="http://laptop-6dan5qsf:3000/">Главная</a>
</li>
<li>
<a href="http://laptop-6dan5qsf:3000/video">Видео</a>
</li>
<li>
<a href="http://laptop-6dan5qsf:3000/chat">Чат</a>
</li>
<li>
<a href="http://laptop-6dan5qsf:3000/photo">Фото</a>
</li>
</ul>
</nav>
</div>
</div>
</header>
<div class="box4">
<div class="mmm">
<ul id="messages"></ul>
<form action="">
<input id="m" autocomplete="off" /><button>Send</button>
</form>
</div>
</div>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
$(function () {
var socket = io();
$('form').submit(function(){
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
const el = document.querySelector('.mmm');
window.scrollTo(0, el.scrollHeight);
});
});
</script>
</script>
<script>
</script>
</div>
</body>
</html>