La copie de code est la suivante:
<script type = "text / javascript">
var zfl = {};
zfl.getLength = fonction (str) {
var realLength = 0, len = str.length, charcode = -1;
pour (var i = 0; i <len; i ++) {
charcode = str.charcodeat (i);
if (charcode> 0 && charcode <= 128) realLength + = 1;
else realLength + = 2;
else realLength + = 2;
else realLength + = 2;
<script type = "text / javascript">
alert (zfl.getLength ("Chine 123zkrljl"));
</cript>
L'effet est montré dans l'image: