全角半角转换 [急]
求一JS代码
在一个文本框里输入 商场ABCDABCD12341234
自动转换成 商场ABCDABCD12341234
就是把字符串中全角转成半角,半角不变
------解决方案--------------------http://topic.csdn.net/t/20061103/10/5130161.html
用StrConv( "商场ABCDABCD12341234 ", vbNarrow)就可以
------解决方案--------------------Function GetHalfString(strCommix)
Dim strChar
Dim intAsc
Dim strTmp
For i = 1 To Len(strCommix)
strChar = Mid(str1, i, 1)
intAsc = Asc(strChar)
If (intAsc> =-23583 And intAsc <=-23558) Or (intAsc> =-23615 And intAsc <=-23590) Or (intAsc> =-23632 And intAsc <=-23623) Then
strTmp = strTmp & Chr(Asc(strChar)+23680)
Else
strTmp = strTmp & strChar
End if
Next
GetHalfString = Trim(strTmp)
End Function
str1 = "商场ABCDABCD12341234 "
Response.Write GetHalfString(str1)