• 回答数

    3

  • 浏览数

    273

毛的惊喜
首页 > 英语培训 > 禁止输入英文

3个回答 默认排序
  • 默认排序
  • 按时间排序

小淘的萌

已采纳

VB.NET 可以用正则表达式呀.Imports System.Text.RegularExpressions'只能输入数字Public Shared Function IsHalfAlpNum(ByVal inField As String) As Boolean Dim ex As Regex = New Regex("[^0-9]") Return Not ex.IsMatch(inField)End Function'只能输入数字和小数点Dim ex As Regex = New Regex("[^0-9|^.]")'只能输入字母Dim ex As Regex = New Regex("[^A-Za-z]")

禁止输入英文

290 评论(11)

喵布拉基

我猜你是想检查bb里是不是有非数字的字符,如果有,给一个提示,并把bb清空,是这个意吧.把最下面的函数按这个改就行了. qd.onclick=function(){ if(bb.value.length>11){ alert("不能大于11位"); bb.value="" } else if(bb.value.length<11){ alert("不能小于11位") bb.value="" } if(/\D/gi.test(bb.value)){ alert("不能输入非数字字符") bb.value="" } }

104 评论(8)

star小朋友

(asp)If ASC(文本框内容) > 47 ASC(文本框内容) < 58 Then response.write"........." Else KeyAscii = 0End If(VB)Public Sub JustNum(KeyAscii%) '本函数把所有非数字或小数点的按键忽略掉 If KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Or KeyAscii = Asc(".") Then Exit Sub Else KeyAscii = 0 End IfEnd Sub

188 评论(10)

相关问答