[b][i] buttons.. textarea
Moderator: General Moderators
[b][i] buttons.. textarea
I was wondering how the is done.
How do those buttons work above the textarea for example in these forums.
When click on [~B] a [b~] appears in the textarea
Can somebody let me in on that secret?[/b]
How do those buttons work above the textarea for example in these forums.
When click on [~B] a [b~] appears in the textarea
Can somebody let me in on that secret?[/b]
The following links may help:
http://p2p.wrox.com/archive/javascript_ ... 1-08/0.asp
http://www.interactivetools.com/product ... nload.html
http://p2p.wrox.com/archive/javascript_ ... 1-08/0.asp
http://www.interactivetools.com/product ... nload.html
Code: Select all
<?php
$message = str_replace("[b]","<b>",$message);
?>something along these lines:
Code: Select all
function insert(text) {
text = ' ' + text + ' ';
if (document.post.comment.createTextRange && document.post.comment.caretPos) {
var caretPos = document.post.comment.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
document.post.comment.focus();
} else {
document.post.comment.value += text;
document.post.comment.focus();
}
}
//-->
</script>Login with webmaster/webmaster at http://home.mysth.be/~timvw/test/
Source is at http://home.mysth.be/~timvw/programming ... syform.zip
But i think htmlArea is nicer too... Should find some time to dig into that
Source is at http://home.mysth.be/~timvw/programming ... syform.zip
But i think htmlArea is nicer too... Should find some time to dig into that
At the moment they are down :/ But when root wakes up, i'm pretty sure he'll kick the machine back in action till eternity 
It makes use of the Pear::HTML_BBCode package. Although i added a custom filter to have
It makes use of the Pear::HTML_BBCode package. Although i added a custom filter to have
Code: Select all
sourcecode highlight.