Alphanumeric Characters Script

This javascript will help you to accept only strings and numbers and donot accept special characters.It checks alphanumeric characters.

Features

  • By using this javascript, the textbox accepts only strings and numbers but not the special characters. It checks for alpha numeric characters alone.
  • Just copy the code into your page and use it.

Preview


This textbox do not accept special characters like $,%,#,@ etc,but accept underscore

Enter the numbers and strings

Downloads

Javascript
<!--Script by hscripts.com-->
<!-- More scripts @ https://www.hscripts.com -->
<script type="text/javascript">
var r={'special':/[\W]/g}
function valid(o,w)
{
o.value = o.value.replace(r[w],'');
}
</script>
<!-- Script by hscripts.com -->

HTML Code
<!-- Script by hscripts.com -->
<form id="myform">
Enter the strings and numbers.It donot accept special characters like $,%,#,@ etc,but accept underscore<br><br>
<center><input type="text" size="25" name="comments" onkeyup="valid(this,'special')" onblur="valid(this,'special')"><br><br></center>
<div align=center>&copy;<a href="https://www.hscripts.com" style=color: #3D366F;text-decoration:none;cursor:pointer;font-size:13px">hscripts.com</a></div>
</form>
<!-- Scripts by hscripts.com -->
  • Release Date - 07-04-2008
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • This script is used to accept only strings and numbers and do not accept special characters.
  • The function valid() is called for validation that is the typing character is a special character means remove that characters because this text box doesn't accept special characters.
  • Copy the code into your page and use it.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question