Validating special character using Javascript

Javascript Code:

 

function specialcharecter()

            {

                var iChars = "!`@#$%^&*()+=-[]\\\';,./{}|\":<>?~_";   

                var data = document.getElementById("txtCallSign").value;

                for (var i = 0; i < data.length; i++)

                {      

                    if (iChars.indexOf(data.charAt(i)) != -1)

                    {    

                    alert ("Your string has special characters. \nThese are not allowed.");

                    document.getElementById("txtCallSign").value = "";

                    return false; 

                    } 

                }

            }

Note: ‘txtCallSign’ is the Id of the textbox.