Tuesday, 27 August 2013

javascript syntax not understood

javascript syntax not understood

in a javascript I noticed this thing that I did not understand how it works:
function validate_pin(frm)
{
var piN = document.getElementById('codice');
if (!piN) {
var piN = document.getElementById('invio');
}
if (!piN.value.match(/^\d{3}$/) && !piN.value.match(/^\d{4}$/)) {
// SORRY! WRONG PIN!
//alert('ATTENZIONE! INSERIRE UN PIN NUMERICO!');
alert('Attenzione! Codice PIN errato!');
piN.focus();
return false;
}
}
and the string if (!piN.value.match(/^\d{3}$/) &&
!piN.value.match(/^\d{4}$/)) what it means?

No comments:

Post a Comment