PDA

View Full Version : Javascript BB code, Textbox insert


Markpyro
07-13-2006, 8:36 PM
I need a simple script written for me, or found.
I'm writing code for a little forum, and I found a script that turns BBcode into HTML for the user, and I want to make it easy to insert by having buttons on top (just like any other forum) that inserts a string such as
[*b] [*/b]
into a textbox at the end of whatever text is written. I'm not very familiar with javascript, but I know it can be done.

I only need 6 tags-
the simple ones (take out asterisks)

[*b][*/b]
[*u] [*/u]
[*i] [*/i]


And the ones, that if possible, like other forum software, display a text box in which the user would input a url for Images, Links, and Email Links

For the Links, the popup would appear, the user would enter the URL, and the code would appear as:

[*url=http://blah.com]http://blah.com[*/url]

Same for Emails

[*email=test@test.com]test@test.com[*/email]

And images

[*IMG]http://linkhere.com[*/IMG]


Thanks to those who can help, I'm absolutely horrible in this area :/

TimP
07-13-2006, 9:14 PM
If you post the form snippet I may be able to whip something up.

Markpyro
07-14-2006, 12:26 PM
I need all the text go go into a <textarea> named "body". There are several spots where I'd be implimenting this code, so there is no one form, though I do believe I'd be able to edit whatever you come up enough so I would be able to cater it to each form.

TimP
07-14-2006, 5:31 PM
http://timbo87.home.comcast.net/temp/markpyro.htm

Markpyro
07-14-2006, 5:40 PM
Thank you, so much :P, it looks awesome.