PDA

View Full Version : Quote Comment - WordPress Help



Budde
08-03-2008, 07:57 PM
Hello -

I'd like to make it so, when someone clicks a link that says "Quote" in a comment on my wordpress blog, they get it in the <blockquote> tag.

This is what I have so far:

JavaScript:


<script type="text/javascript">
//<![CDATA[
function Quote(commentID,author,commenttext) {
var Quote='<blockquote> By <a href="#comment-'+commentID+'">'+author+'</a>:<br><br>'+commenttext+'</blockquote> ';
var myField;
if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
myField = document.getElementById('comment');
} else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = Quote;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ Quote
+ myField.value.substring(endPos, myField.value.length);
cursorPos += Quote.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += Quote;
myField.focus();
}
}
//]]>
</script>

HTML Link:

<a href="#" onclick='Quote("<?php comment_ID() ?>", "<?php comment_author(); ?>", "<?php comment_text() ?>")' title="Quote this Comment">Quote</a>

Jesdisciple
08-04-2008, 08:05 PM
OK... What problems are you having?