<script type="text/javascript">

var s='djh.doiwe.esd.d.ddd0sdd.d.';
var n=(s.split('.')).length-1;
document.write(n);

</script>

结果:6