liam1412 Posted December 6, 2006 Share Posted December 6, 2006 I'm back againI have written BBcode for my forum but don't want people to have to manually type the :-) or whatever. How do I create the buttons such as the ones used in this forum that input the ;-) into the post as itis being typed. This may not even be php but im not ure how its done.Thanks Quote Link to comment Share on other sites More sharing options...
joquius Posted December 6, 2006 Share Posted December 6, 2006 You need to use javascript. Like add a button<input type="button" onclick="link()" /><textarea id="text"></textarea>and add some JS at the topfunction link (){var link = prompt ("Enter URL:", "")if (link!="") var text = prompt ("Enter text:", "");document.getElementById('text').value=document.getElementById('text').value+"[link=\""+link+"\"]"+text+"[/link]"}but that just adds it at the end of the text..I can't remember how to add it where you're typing, and if you want to highlight text and then click the button, it's a bit more complex. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.