Page 1 of 1

how to add Smileys in a texarea?

Posted: Tue Jul 16, 2002 8:32 pm
by qads
hey..
how can i add a code(:smile:) at current cusor location in a a text area?
i know it would have to be done with java and later on i will i have to use ereg_replace, but that's for later on.

thanks for your help.

Posted: Wed Jul 17, 2002 3:26 am
by will
i don't think you can add at the current cursor location. only one thing can be 'focused' at a time, and when you click on the emoticon, you lose focus in the textbox, and therefore lose the cursor location info. all message boards i've seen always append to the end of text block. check the source for phpBB or YaBB for such scripts.

Posted: Wed Jul 17, 2002 3:30 am
by hob_goblin
yeah.. what he said :-D that about sums it up.

you might be able to use onmouseover, but that would be very... annoying if you accidently moved the mouse over it on accident

Posted: Wed Jul 17, 2002 7:35 am
by qads
if you can't add a code at current cusor location then how does phpbb2 do it? i looked at the source and got a link from which a java script was used.

http://www.faqts.com/knowledge_base/vie ... 52/fid/130
the only problem is i don't understand it :cry: , i don't know how to use that script on my <textarea>.
help with that will be great!

thanks