Вывести сверху
Всем приветы.
Вот код,он выводит сообщения в таком порядке: 1.Старое сообщение 2.Новое сообщение 3.Самое новое сообщение А нужно, что-бы 2.Новое сообщение выводило сверху. function update () { setTimeout ( "aktualizuj()", 500 ); setTimeout ( "update()" , 1500 ); } function aktualizuj() { getAll ( function ( wiadomosci ) { var wiadomosciElement = document.getElementById ( "msg" ); while ( wiadomosciElement.hasChildNodes() ) { wiadomosciElement.removeChild ( wiadomosciElement.firstChild ); } var dlugosc = wiadomosci.length - 1 if ( wiadomosci.length != 0 ) { for ( var i = 0; i <= dlugosc; i++ ) { var row = document.createElement("tr"); var data = wiadomosci[i][0]; var nick = wiadomosci[i][1].toString().htmlEntities(); var wiadomosc = wiadomosci[i][2].toString().htmlEntities(); var kolor = wiadomosci[i][3] + ', ' + wiadomosci[i][4] + ', ' + wiadomosci[i][5]; var typ = wiadomosci[i][6]; var cell = document.createElement("td"); cell.className = "czas" cell.innerHTML = data; row.appendChild ( cell ); var cell2 = document.createElement("td"); cell2.className = "tryb" cell2.innerHTML = typ row.appendChild ( cell2 ); var cell3 = document.createElement("td"); cell3.innerHTML = '<span style="color: rgb('+kolor+'); font-weight: bold;">'+nick+'</span>'; row.appendChild ( cell3 ); var cell4 = document.createElement("td"); cell4.innerHTML = wiadomosc; row.appendChild ( cell4 ); wiadomosciElement.appendChild ( row ) } } } ); } String.prototype.htmlEntities = function () { return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }; function sendMsg (e) { var keynum; var keychar; var numcheck; keynum = e.which; if (keynum == 13) { send(); } }; function sendMsgTB (e) { var keynum; var keychar; var numcheck; keynum = e.which; if (keynum == 13) { sendTB(); } }; function send () { var input1 = document.getElementById("wiadomoscI"); if ( input1.value == "Wiadomosc" ) { alert ( "Введите ваше сообщение!" ); return 0; } if ( input1.value != "" ) { sendMessageToAllPlayers ( input1.value, function ( playerCount ) {}); input1.value = ''; } else { alert ( "Type your message to send!" ); } } function sendTB () { var input2 = document.getElementById("TopBarSend"); if ( input2.value == "Wiadomosc" ) { alert ( "Введите ваше сообщение!" ); return 0; } if ( input2.value != "" ) { sendMessageTopBarToAllPlayers ( input2.value, function ( playerCount ) {}); input2.value = ''; } else { alert ( "Type your message to send!" ); } } function wlasciwosciB() { var wiadomosc = document.getElementById('wiadomoscI'); if (wiadomosc.value=='') wiadomosc.value='Сообщение в Чат'; }; function wlasciwosciBTB() { var wiadomosc = document.getElementById('TopBarSend'); if (wiadomosc.value=='') wiadomosc.value='Сообщение в ТопБар'; }; function wlasciwosciF() { var wiadomosc = document.getElementById('wiadomoscI'); if (wiadomosc.value=='Сообщение в Чат') wiadomosc.value=''; }; function wlasciwosciFTB() { var wiadomosc = document.getElementById('TopBarSend'); if (wiadomosc.value=='Сообщение в ТопБар') wiadomosc.value=''; }; Заранее благодарен |
|
Не совсем понимаю как его туда встроить...
|
Цитата:
По окончании сообщений вывести самое последнее, что было запомнено. |
Часовой пояс GMT +3, время: 12:08. |