使用asp.net页面上的javascript限制文本输入文本框 [英] Restrict text from being entered into textbox using javascript on asp.net page
本文介绍了使用asp.net页面上的javascript限制文本输入文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何限制使用javascrip输入文本框中的值,实际上tetbox附加了一个ajax日历扩展程序,我不希望用户手动在文本框中输入任何值。实际上我尝试使用文本框的readonly属性,但在回发后,内容可以提交到数据库。
解决方案
试试这个示例
< asp:TextBox ID = TextBox1 onkeypress = return false; runat = server > < / asp:TextBox >
< asp:CalendarExtender ID < span class =code-keyword> = fffddd2 runat = server TargetControlID = TextBox1
格式 = MMM d,yyyy > < / asp:CalendarExtender > 跨度>
How can i restrict value from being entered into a textbox using javascrip, actually the tetbox has an ajax calender extender attached to it and i dont want user to manually enter any value into the textbox. Actually i i tried using the readonly property of the textbox but after post back the content could be submitted into the database.
解决方案
try this exampal
<asp:TextBox ID="TextBox1" onkeypress="return false;" runat="server"></asp:TextBox> <asp:CalendarExtender ID="fffddd2" runat="server" TargetControlID="TextBox1" Format="MMM d, yyyy"></asp:CalendarExtender>
这篇关于使用asp.net页面上的javascript限制文本输入文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文