Close

Dynamic comment previewing

| Post a comment | Share this

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

Your blog

This is the avatar for your blog's URL. It will appear next to all your comments. To change your avatar and get other benefits for your blog, go to MyBlogLog.

Comment preview

Subscribe to comments
You can subscribe using RSS or Bloglines to any further comments on this entry. You can also subscribe by email by checking the box below.

About this Entry

This page contains a single entry published on February 18, 2007 11:53 PM.

Blog's back was the previous entry in this blog.

Virgin Mobile GPRS access from a Palm OS device is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Archives

Subscribe

Subscribe to my feedSubscribe with Bloglines

Articles
RSS | Bloglines

Comments
RSS | Bloglines

Sign up for instant email updates
Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by Movable Type 4.1