限制文本框以接受单引号 [英] Restrict Text box to accept single quotation
本文介绍了限制文本框以接受单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我需要限制文本框以接受单引号。请有人帮我解决这个问题。
谢谢
Mohan
解决方案
使用RegularExpressionValidator
你可以让它工作
设置ValidationExpression ='^ [^ \] *
'限制报价输入。
参考类似讨论在CP上:验证文本框以防止引号使用 [ ^ ]
< html>
< head>
< script type = text / javascript language = javascript >
function checkQuote(){
if ( event .keyCode == 39 ){
event .keyCode = 0 ;
return false ;
}
}
< / script >
< / head >
< body>
< input type = text onkeypress = return checkQuote(); />
< / body >
< / html > 跨度>
Hi All
I need to restrict text box to accept single quotation mark. Please anyone help me to achive this.
Thanks
Mohan
解决方案
By usingRegularExpressionValidator
you can make it work
Set theValidationExpression ='^[^\"]*
' to restrict quotes input.
Refer similar discussion on CP: Validation of a textbox to prevent quotation marks to be used[^]
<html> <head> <script type="text/javascript" language="javascript"> function checkQuote() { if(event.keyCode == 39) { event.keyCode = 0; return false; } } </script> </head> <body> <input type="text" onkeypress="return checkQuote();" /> </body> </html>
这篇关于限制文本框以接受单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文