I'm making a comments system and I'm adding a BBCode quote system.
It works great for one quote, but if you try to quote a quote it messes up. I would rather there only be one quote. So, I want a function to remove [ quote]quoted message[/ quote] when it adds the quote tags.
This is hard to explain, I hope you get what I mean.
Here's is my function to add the quote tags in the first place:
Code:
function addQuote(user,quote) {
var newtext ="[ quote="+user+"]"+quote+"[/ quote]";
document.post.post_body.value += newtext;
}
And my usage:
Code:
<a href="javascript:addQuote(\''.$userRow['username'].'\',\''.$cRow['comments_body'].'\');">Quote</a
Works great. But, like I said, I need the function to strip anything between the quote tags before it's quoted... if that makes any sense at all....
I was thinking I'd have to use regex, but I'm only a newbie with Javascript and that looks intimidating. I'm good at modifying existing code, so if anyone use a tutorial that glances at what I'm trying to do that'd be great too.
Thanks.
EDIT: Hmm, I have to put spaces in my function above because it messed up the forum's quotes, lol.
Last edited by CrazeDizzleD : 03-04-2008 at 03:39 PM.
|