I did that and same problem... captcha works only if i click " Refresh "


That stinks that it didn't work for you. There was a slight error in my original code though. Try changing the refresh_captcha.js file to this:
components/com_jcomments/js/refresh_captcha.js line 1:
window.onload=function(){
jcomments.clear('captcha');
}
Since refresh_captcha.js is being called in the <head> "jcomments.clear('captcha');" was being executed before the rest of the page is rendered (including the main jcomment code) so you probably were getting a "jcomments is undefined" javascript error.
Sadly though, even after this fix I don't think this solution works. It logically seems correct and it seemed to have resolved the issue on our site for a while but magically it started happening again recently even with this "fix" in place. Even worst, now when it does happen clicking the captcha refresh button numerous times doesn't fix it, nor does clearing the Firefox cache and reloading the page fix it either.
For now on my site I'll be making it so that as long as you type in exactly 5 characters, it'll accept the captcha as correct regardless of what those characters are. This should keep still keep out the auto-spammers while allowing users of strong-caching browsers (like Firefox) to post comments without ever encountering this issue.
If you'd like to do the same for your site here is the change you'll need to make:
/components/com_jcomments/jcomments.captcha.php line ~29:
original:
return (($code != '') && ($code == $_SESSION['comments-captcha-code']));
edit:
return (strlen(utf8_decode($code)) == 5);
That takes the code the user entered, decodes it out of UTF-8 and counts it. If it's 5 characters it returns true, else it returns false (the urf8_decode() is optional when I thought about it since all the captcha characters are within the 1-byte UTF-8 domain, but I left it in just in case).
FYI, this new work-around doesn't depend on my non-working one so you can remove those changes and just have this one.
I hope a better solution is found sometime though...