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
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!
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.