how to add Smileys in a texarea?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

how to add Smileys in a texarea?

Post 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.
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post 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.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post 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
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post 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
Post Reply