Microsoft®
Jan. 18th, 2005 04:09 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Нет, други мои, не удержусь. Вот вам проверка из предыдущего поста. Такую красоту нельзя прятать, любуйтесь все:
<script language='javascript'> function validatePhone_contactPhoneNumber(oSrc){ // if number is greater than 10 digits, // allow any digits, dashes and '+' at the beginning, // must have at least one dash. // this is what we are using for intl entry. var regx = new RegExp(/^\d+$/); var ndigitCount = 0; var strValue = document.all.contactPhoneNumber.value; var valueWithSpacesRemoved = ''; // make sure all characters are either digits, dashes, periods, or '+' for (var i = 0; i < strValue.length; i++) { if (regx.test(strValue.charAt(i))) { ndigitCount++; continue; } if (strValue.charAt(i) == '-') { continue; } if (strValue.charAt(i) == ' ') { continue; } if (strValue.charAt(i) == '.') { continue; } return false; } //must have at least 4 digits if(ndigitCount < 2){ return false; } return true; } </script>
Предлагаю конкурс — кто найдёт больше несоответствий кода и комментариев…