在asp.net4.0中进行验证 [英] validation in asp.net4.0
本文介绍了在asp.net4.0中进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在asp.net中以简单的方式验证输入整数和字符
validation in asp.net for input integer and character in a simple way
推荐答案
如果要限制特殊字符,请尝试此
If you are trying to restrict special characters then try this
function valid()
{
debugger;
var s = "!@#
%^& *()+ =-[] \\\';,./{} | \:<>?" ; str = document.getElementById(' <%= TextBox1.ClientID%>'). class ="code-sdkkeyword">值; for ( var i = 0 ; i < str.length; i ++) { 如果(s.indexOf(str.charAt(i))!= -1) { 警报(" ); document.getElementById(' <%= TextBox1.ClientID%>').值 = " ; 返回 假; } } }
%^&*()+=-[]\\\';,./{}|\":<>?"; str=document.getElementById('<%=TextBox1.ClientID%>').value; for (var i = 0; i < str.length; i++) { if (s.indexOf(str.charAt(i)) != -1) { alert ("The box has special characters. \nThese are not allowed.\n"); document.getElementById('<%=TextBox1.ClientID%>').value=""; return false; } } }
这篇关于在asp.net4.0中进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文