<script type="text/javascript">
function insert_smile() {
document.forms['myform'].elements['mytextbox'].value += ' :)';
}
</script>
<form name="myform">
<input type="button" value=" :) " onclick="insert_smile();" />
<textarea id="mytextbox"></textarea>
</form>
function replace_smiley($text)
{
$text = str_replace("","<img src='smiley.gif' alt=''>", $text);
return $text;
}
echo replace_smiley($message);
i'm using greymatter and i have the smiles all set up and there but when i click on one of the smile images
and send the meassage all i get is the :O <---those things
function emoticon($dataWithSmileys,$smileyImageDir) {
// array of emoticons and pictures
$pic = array(
":(" => "frown.gif",
":(" => "frown.gif",
":)" => "smile.gif",
":D" => "biggrin.gif",
":o" => "redface.gif",
":p" => "tongue.gif",
";)" => "wink.gif" );
//Manipulate directory
$realDir = preg_replace("/\/*$/","",$smileyImageDir);
// list emoticons
if(!$dataWithSmileys) {
echo "<p>\n";
foreach($pic as $i => $j) {
echo "<img src=\"$realDir/$j\" border=\"0\" alt=\"$i\" /> $i
<img src=\"$realDir/$j\" border=\"0\" alt=\"$i\" /><br />\n";
}
echo "</p>\n";
}
else {
$b = $dataWithSmileys;
foreach($pic as $i => $j) {
$c = addcslashes($i,"(");
$b = ereg_replace("[[:space:]]". $c ."[[:space:]]","
<img src=\"$realDir/$j\" border=\"0\" alt=\"$i\" /> ",$b);
}
return $b;
}
}