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 Link to comment https://forums.phpfreaks.com/topic/29666-the-buttons-in-the-forum/ 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. Link to comment https://forums.phpfreaks.com/topic/29666-the-buttons-in-the-forum/#findComment-136163 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.