Oto skrypt:
<script type='text/javascript'> // If the element's string matches the regular expression it is numbers and letters function isAlphanumeric(elem, helperMsg){ var alphaExp = /^[0-9a-zA-Z]+$/; var error = false; if(elem.value.match(alphaExp)){ error = true; }else{ alert(helperMsg); elem.focus(); error = true; } if (error) { return false; } } </script>
A tak jest wywolywany:
<input type="submit" onclick="isAlphanumeric(document.getElementById('nazwa'), 'Dozwolone znaki: A-Z,0-9 !')" value="bleble" style="width: 140px;font-family:Tahoma;margin-top:-5px;" />