my smileys dont show on my postForm and when am clicking enter it doesnt send smilyes to my postForm,here is my code :
<div id="status"></div>
<div class="postForm">
<form action="<?php echo $username; ?>" method="POST">
<textarea id="post" name="post" rows="4" cols="199"></textarea>
<input type="submit" name="send" value="Post" style="bacground-color:#DCE5EE; float: right; margin-right:10px; border: 1px solid #666; color:#666;height:60px; width:65px;"/>
</form>
<img src="smiley/angry.gif" onclick="insertSmiley(':-D')" />
<script type="text/javascript">
function insertSmiley(smiley)
{
var currentText = document.getElementById("post");
var smileyWithPadding = " " + smiley + " ";
currentText.value += smileyWithPadding;
$('#post').keyup(function(e){
if (e.keyCode == 16) {
var post = $(this).val();
$.post('replace.php', {post: post}, function(data){
$('#status').append(data + '<br/><br/>');
});
}
});
}
</script>
</div>
my replace.php code:
<?php
$message = @$_POST['message'];
$message = str_replace(':-D','<img src=smiley/angry.gif',$message);
echo"$message";
?>
thanks, hope you will find the way to help me…