Jump to content


Photo

BBCode, insert text into a textarea where the insertion point is located.


  • Please log in to reply
1 reply to this topic

#1 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 08 October 2006 - 12:23 PM

Hello,
I'm currently using the code

function emotion_news(em) {
	document.news.nBody.value=document.news.nBody.value+em;
}

<a onClick="emotion_news(' :evil: ')" style="cursor: pointer;"><img src="images/emotions/evil.gif" border=0 alt=":evil:"></a>

So far it works flawlessly, the only problem is that it ALWAYS inserts ANY bbcode I have it use at the bottom of the document. I was wondering if anyone knew how to make it insert it wherever your insertion point may be in the document.

I don't care about wraping tags where you can select text and have tags placed on both sides, I just want the one piece of bbcode placed on the insertion point instead of at the end of the text area.


If anyone can help me out, thanks  ;D
Avid PHP Developer, need some work done? Send a PM ;)

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 October 2006 - 03:47 PM

Find the insertion point in a TEXTAREA is complicated, and varies between browsers.  I'm pretty sure I've seen a thread to this effect on this board not too far back.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users