0

Ok , so I am creating a forum, I have successfuly installed the BBcodeParser PEAR package, everything works perfectly.

Now when someone wants to write a new topic, he has a bar, to turn text into bold for example.

Now how can I apply the BBcode based on the user's request?. (for example , when he marks some text and clicks on the [B] button, how can I make that text bold?)

It sounds simple to me, I just add [b] before , and [/b] after that text he marked, but I realy need a hint on where to start , and do I need javascript? , should I do it with buttons or hyperlinks?

And when he clicks the B button, I dont want to refresh the whole page...

thank you very much for your help in advance.

4

1 回答 1

0

它简单明了。当您想根据某些用户操作做某事时,您需要 javascript。为了使它更容易,您可以使用一些 javascript 库(我最喜欢的 jQuery)。如果您真的想学习,最好编写自己的代码,但是有很多插件可用于您想做的事情。在 php 和 javascript 中。使用 javascript,您可以生成用户输入内容的快速预览,使用 php,您可以解析短代码(如 [b]I'm bold[/b] 为等效的I'm bold并将其存储在数据库中以供将来使用。我' d 建议你 google 并从那里开始。研究 stackoverflow 上提供的编辑器。比其他可用的替代品轻得多,但仍然具有丰富的可用性。

于 2012-06-29T19:18:27.523 回答