ASP.NET中的Java验证 [英] Javascript validations in asp .net
本文介绍了ASP.NET中的Java验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,
我在JavaScript验证中遇到问题,页面中有大约100英寸的文本框,并且所有文本框都是必填项,因此我想检查这些文本框.
您能帮我解决这个问题吗?我可以在提交时检查一个文本框.但是我无法一次检查所有文本框.我想为所有文本框重新使用相同的功能.
Hi Friends,
I have a problem in JavaScript validations, i have around 100''s of text-boxes in the page and all the text-boxes are compulsory , so i want to check the text-boxes.
could you please help me to resolve this problem. I am able to check one textbox on submit. but i am not able to check all the textboxes at once.I want to re-utilise the same function for all the text-boxes.
推荐答案
您好,
您可以编写一个检查验证的函数,并为事件"onfocusout"调用该函数.将文本框控件传递给该javascript函数.
示例代码
Hi,
You can write one function that checks the validtions, and call that function for the event "onfocusout".Pass the text box control to that javascript funtion.
sample code
<asp:texbox .....
onfocusout="Validatetextbox(this)" > </asp:Textbox>
function Validatetextbox(this)
{
//your validation here
//ctrl.value gives the value in that textbox
}
希望这会有所帮助.
Hope this helps.
这篇关于ASP.NET中的Java验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文