对文本框中的空格进行Javascript验证 [英] Javascript validation for spaces in text box

查看:85
本文介绍了对文本框中的空格进行Javascript验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文本框可以接受所有类型的数据,如字母,数字,特殊字符...如果空格不是有效值,应该给出错误消息''

当我点击一个按钮...在

asp.net中使用c#通过javascript。(单击按钮后的javascript验证)。

My Text box can accept all types of data like alphabets,numeric,special characters ... Should give an error message ''if space is not a valid value ''
when i am clicking a button... in
asp.net with c# through javascript.(javascript validation after clicking a button).

推荐答案


我的文本框可以接受所有类型的数据,如字母,数字,特殊字符......如果空格不是有效值,应该给出错误信息''

,当我点击一个按钮...在

asp.net中使用c#通过javascript。(点击按钮后的javascript验证)。
My Text box can accept all types of data like alphabets,numeric,special characters ... Should give an error message ''if space is not a valid value ''
when i am clicking a button... in
asp.net with c# through javascript.(javascript validation after clicking a button).



这仍然是一个JS问题。建议使用click事件和正则表达式。 HTH。

This is still a JS problem. Suggest using click event and regular expressions. HTH.


请给我发送javascript代码(空间验证)它在我的项目中非常重要...
please send me javascript code for that(Space validation) it is very importent in my project...


我试过以下代码


函数验证()

{

if(document.getElementById("<%= TextBox1.ClientID%>")。value =="")

{

alert(" No Feild不能为空)< br />
document.getElementById("<%= TextBox1.ClientID%>")。 focus();

返回false;

}

}


此代码仅在没有空白,但我想没有空格验证


请帮帮我...
i was tryed the below code


function validate()
{
if (document.getElementById("<%=TextBox1.ClientID%>") .value=="")
{
alert("No Feild can not be blank");
document.getElementById("<%=TextBox1.ClientID%>"). focus();
return false;
}
}

this code only validate without blank but i want to without spaces validation

please help me...


这篇关于对文本框中的空格进行Javascript验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆