Disculpa, no lo habia probado, y sí eso no funciona, proba asi:
Código HTML:
<script type="text/javascript">
var msg = 'text1, text2, text3,';
var output = '';
for(var i=0;i<msg.length;i++){
if(i==msg.lastIndexOf(',')){
output += '.';
}else{
output += msg.charAt(i);
}
}
document.write(output);
</script>
Suerte... Saludos...