»
AnglaisFran�aisVietnamien

Imprimer - Validation (SSN) - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Validation » Validation (SSN)
URL: https://www.javascriptbank.com/validation-ssn.html

Validation (SSN) © JavaScriptBank.comEntrez le numéro de sécurité sociale en utilisant soit le chiffre 9 ou NN-NNN-NNNN format. Les plages de numéros peuvent être facilement modifiés par la SSA, ce n'est pas cochée.

Version compl�te: jsB@nk » Form » Validation » Validation (SSN)
URL: https://www.javascriptbank.com/validation-ssn.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Carol Gevers// Sandeep V. Tamhankar ([email protected])<!-- Beginfunction SSNValidation(ssn) {var matchArr = ssn.match(/^(\d{3})-?\d{2}-?\d{4}$/);var numDashes = ssn.split('-').length - 1;if (matchArr == null || numDashes == 1) {alert('Invalid SSN. Must be 9 digits or in the form NNN-NN-NNNN.');msg = "does not appear to be valid";}else if (parseInt(matchArr[1],10)==0) {alert("Invalid SSN: SSN's can't start with 000.");msg = "does not appear to be valid";}else {msg = "appears to be valid";alert(ssn + "\r\n\r\n" + msg + " Social Security Number.");   }}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form><tt>SS #:  <input type=text name=ssn size=11 maxlength=11> (use dashes!)</tt><p><input type=button value="Validate Number" onClick="SSNValidation(this.form.ssn.value);"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->