I've added dynamic comment previewing to the blogs. I'm following the instructions over here, but as you can tell from my discussions with the author, there are bugs. Here are the changes I had to make to get it to work:
1) Change the JavaScript to the following:
// Dynamic Comment Preview - Kudos to Mike Industries for the inspiration!
// D.C.P. - Comment Text
function ReloadTextDiv() {
document.getElementById('TextDisplay').innerHTML = '<p>'+document.getElementById('comment-text').value.replace(/(\r\n|\n)/g,'<br />').replace(/(<br \/>){2,}/gi,'<'+'/p><p>')+'<'+'/p>';
}
// D.C.P. - Comment Author
function ReloadNameDiv() {
document.getElementById('NameDisplay').innerHTML= document.getElementById('comment-author').value;
}
// End Dynamic Comment Preview
You'll notice I changed
document.getElementById('NameDisplay').innerHTML = document.comments_form.comment-author.value;
to
document.getElementById('NameDisplay').innerHTML= document.getElementById('comment-author').value;
2) I added “margin-left: 0px; padding-left: 0px;” to the div containing the POST button.
3) In step 2, I changed
var authname = getCookie(“mtcmtauth”);
document.write(authname);
to
document.write(commenter_name)
4) I also changed
<p class=“comment-footer”>Posted by:
<span class=“author”><a href=“#” id=“NameDisplay”>
to
<p class=“comment-footer” style=“padding-left: 0px; margin-left: 0px”>Posted by:
<span class=“author”><a href=“#” id=“NameDisplay”>
Now it looks right and works properly.
Leave a comment