如何在一个按钮上显示所有JavaScript消息单击 [英] How to Display all Message of JavaScript on one Button Click
本文介绍了如何在一个按钮上显示所有JavaScript消息单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我正在使用各种文本框的客户端验证,我需要在单个提交按钮上显示所有消息点击。
请帮助我尽快
解决方案
看看这个..
http://msdn.microsoft.com/en-us/library/dd5c6s6h(v = vs.71).aspx [ ^ ]
这是一个典型的初学者问题。
你可以做两件事之一。
1.当一次验证失败,提醒消息并立即返回。 ie
if ( isNaN (value )== true )
{
alert( 预期数字值);
return false ;
}
2.如您所愿,在一个变量中收集所有错误消息并提醒它。即
var msg = < span class =code-string>;
if ( isNaN (value1)== true )
{
msg + = 输入Field1必须是数字 跨度>;
}
if (value2 == ' ')
{
msg + = \ nInput Field2不能是空的;
}
if (msg == )
return true ;
alert(msg);
返回 false ;
Hi
I am using Client Side validation for various Text box, i need to display all message on single Submit Button Click.
Please Help me ASAP
解决方案
Have a look at this..
http://msdn.microsoft.com/en-us/library/dd5c6s6h(v=vs.71).aspx[^]
This is a typical beginner's problem.
You can do either of two thing.
1. When one validation fails, alert the message and return immediately. i.e.
if(isNaN(value)==true) { alert("Numeric value is expected"); return false; }
2. As you wanted, gather all error message in one variable and alert it. i.e.
var msg=""; if(isNaN(value1)==true) { msg+="Input Field1 must have to be numeric"; } if(value2=='') { msg+="\nInput Field2 cannot be empty"; } if(msg=="") return true; alert(msg); return false;
这篇关于如何在一个按钮上显示所有JavaScript消息单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文