Ik ben bezig met een ajax msnchat
Dat lukt aardig alleen zit ik met een klein probleempje..
als ik een smilie invoer bv : p dan zet hij in chat <img class=\"smilie\" src=\"../smilies/smile.gif\">
ik wil dat hij gewoon die smilie dan laat zien weet iemand hoe ik dat doe?
mvg mboshoven
dit is het stukje code waar hij een reactie indeelt
<?
function insertNewContent(liName,liText) {
insertO = document.getElementById("outputList");
oLi = document.createElement('li');
oSpan = document.createElement('span');
oSpan.setAttribute('className','name');
oSpan.setAttribute('class','name');
oName = document.createTextNode(liName+': ');
oText = document.createTextNode(liText);
oSpan.appendChild(oName);
oLi.appendChild(oSpan);
oLi.appendChild(oText);
insertO.insertBefore(oLi, insertO.firstChild);
}
?>
<?
function getData($lastID) {
$sql = "SELECT * FROM `chat-berichten` WHERE `room`='".$_SESSION['room']."' and `id` > ".$lastID." ORDER BY id ASC LIMIT 60";
$conn = getDBConnection();
$results = mysql_query($sql, $conn);
if (!$results || empty($results)) {
echo 'There was an error creating the entry';
end;
}
while ($row = mysql_fetch_array($results)) {
$name = $row[2];
$text = $row[4];
$id = $row[0];
if ($name == '') {
$name = 'no name';
}
if ($text == '') {
$name = 'no message';
}
$text = bbcode($text);
echo $id." ---".$name." ---".$text." ---";
}
}
?>
717 views