且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

警报或消息框中的验证消息

更新时间:2022-02-02 21:41:56

我假设您是在问问ASP.Net问题.对于必需的字段验证器,您将需要在表单本身中显示错误消息.它不能发出警报.如果您确实需要显示警报,***去实现javascript.在单击按钮或类似操作时检查文本框的值,并显示警报.
I am assuming that you are asking your question w.r.t ASP.Net. For required field validator, you will need to show the error message in the form itself. It cannot come in alert. If you really need to show alerts, better go for implementing javascript. Check the textbox value on button click or similar and display an alert.


^ ]对此具有属性.
ValidationSummary[^] has an attribute for that.


这是一个示例代码 [ http://www.w3schools.com/js/default.asp [ JavaScript入门教程 [
Here is a Sample code[^]

Since you are new to javascript you might find the below links helpful.
http://www.w3schools.com/js/default.asp[^]

Javascript Beginner tutorial[^]