I used this code for validate text box when user paste values to the text box.
Code://Browser Detection var strUserAgent = navigator.userAgent.toLowerCase(); var isIE = strUserAgent.indexOf("msie") > -1; var isNS6 = strUserAgent.indexOf("netscape6") > -1; var isNS4 = !isIE && !isNS6 && parseFloat(navigator.appVersion) < 5; function Paste(objEvent) { var objInput; if (isIE) { objInput = objEvent.srcElement; } else { objInput = objEvent.target; } if (!/^[A-Za-z0-9\s\£\$]*$/.test(objInput.value)) { alert("The character you attempted to used is not allowed for this field."); objInput.value = objInput.validValue || ""; objInput.focus(); objInput.select(); } else { objInput.validValue = objInput.value; } }
It works in other characters but if I paste '£', program did not allow to paste it. How can I solove this problem.
Thanks.


Reply With Quote
Bookmarks