<html><body>
<script language="javascript">
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function emoticon(text) {
if (document.post.textqw.createTextRange && document.post.textqw.caretPos) {
var caretPos = document.post.textqw.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
document.post.textqw.focus();
} else {
document.post.textqw.value += text;
document.post.textqw.focus();
}
}
</script>
bla-bla-bla...
<textarea rows="20" cols="40" name='textqw' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
<img src="/pics/smiley.gif" onmouseover="this.style.cursor='hand';" onclick="emoticon('

');">
</body>
</html>
вот это если засунуть в файл и попробовать запустить не работает((