JavaScript sohbet odası adı renkler

0 Cevap php

Ben bir AJAX / JavaScript / PHP sohbet odasında üzerinde çalışıyorum ve ben tavsiye biraz gerekir. Temel olarak, değerler (mesaj (txt_message), isim ve id sohbet (chat)) şöyle gönderilir zaman:

var param = 'message=' + document.getElementById('txt_message').value;
param += '&name=<b><?php echo $_SESSION['username']; ?></b>';
param += '&chat=2';
sendReq.send(param);
document.getElementById('txt_message').value = '';

I want to make it so each instance of a username ($_SESSION['username']) is a different colour automatically which stays at that particular colour for the duration of the chat. As you will see, so far I have just got the username in bold; I dont know if I am trying to put code in the wrong place or it should be somewhere else. These values are put into a div and i can edit the styles there, but it changes all the just not just the username. Thanks in advance for any advice i recieve and apologies if my explanation is a bit confusing :)

0 Cevap