Jump to content

[SOLVED] Clickable smilies


liam1412

Recommended Posts

Hi

can anyone point me in the direction of how I would go about creating the clickable smiley buttons that input the code for the smiley at the point where the curser is.  Also the code and quote tag that wrap around the highlighted text.  Posted this question on the PHP forum a couple of weeks and got told it was JS but had a look round and can't find anything. Not even in tht Javascript for complete numpties book i've got.
Link to comment
https://forums.phpfreaks.com/topic/30362-solved-clickable-smilies/
Share on other sites

i dont know how to do it as well, having trouble myself, but I found this page:
[url=http://www.createblog.com/forums/index.php?showtopic=51203]http://www.createblog.com/forums/index.php?showtopic=51203[/url]
see how it works and maybe you can teach me afterwards (after you get how to do them)
thanks :D!
Hi Ted_Chou12

I got this off someone on another forum I use - Funnily enough the forum is completely unrelated to PHP.  Just a technical section so i posted in there. Seems to make sense but I am at work so haven't tried it yet

[quote]any ways, what your wanting is an onclick funciton set up for the images...

set the images as links (a href) or as buttons (using css to make them images) and use the following as the href

[code]"document.selection.createRange().text='::smilie::'"[/code]

Example

[code]<a href="document.selection.createRange().text='::smilie::'"><img src="smilie1.png"></a>[/code]

this would then mean, when you click that button, it will execute the javascript link.. this is un tested, but that is the correct function... I will admit, i have never tried it in a href before, i have always used it in form buttons like this one..

[code]<input onclick="document.selection.createRange().text='textofsomesort'" type="button" value="button"><br>[/code]

clicking the button will insert "textofsomesort" into the textbox where the cursor is..[/quote]

Hope it helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.