asp 怎么把vbscript变量结果赋值给session 30
<%session("wtr")="中"%><scriptlanguage=vbscript>'转换拼音PublicFunctionGetPyChar(char)OnEr...
<%session("wtr")="中"%>
<script language=vbscript>
'转换拼音
Public Function GetPyChar(char)
On Error Resume Next
Dim Tmp
Tmp = 65536 + Asc(char)
If Tmp = 53687 Then
GetPyChar = "s"
Exit Function
End If
If (Tmp >= 45217 And Tmp <= 45252) Then
GetPyChar = "a"
ElseIf (Tmp >= 45253 And Tmp <= 45760) Then
GetPyChar = "b"
ElseIf (Tmp >= 45761 And Tmp <= 46317) Then
GetPyChar = "c"
ElseIf (Tmp >= 46318 And Tmp <= 46825) Then
GetPyChar = "d"
ElseIf (Tmp >= 46826 And Tmp <= 47009) Then
GetPyChar = "e"
ElseIf (Tmp >= 47010 And Tmp <= 47296) Then
GetPyChar = "f"
ElseIf (Tmp >= 47297 And Tmp <= 47613) Then
GetPyChar = "g"
ElseIf (Tmp >= 47614 And Tmp <= 48118) Then
GetPyChar = "h"
ElseIf (Tmp >= 48119 And Tmp <= 49061) Then
GetPyChar = "j"
ElseIf (Tmp >= 49062 And Tmp <= 49323) Then
GetPyChar = "k"
ElseIf (Tmp >= 49324 And Tmp <= 49895) Then
GetPyChar = "l"
ElseIf (Tmp >= 49896 And Tmp <= 50370) Then
GetPyChar = "m"
ElseIf (Tmp >= 50371 And Tmp <= 50613) Then
GetPyChar = "n"
ElseIf (Tmp >= 50614 And Tmp <= 50621) Then
GetPyChar = "o"
ElseIf (Tmp >= 50622 And Tmp <= 50905) Then
GetPyChar = "p"
ElseIf (Tmp >= 50906 And Tmp <= 51386) Then
GetPyChar = "q"
ElseIf (Tmp >= 51387 And Tmp <= 51445) Then
GetPyChar = "r"
ElseIf (Tmp >= 51446 And Tmp <= 52217) Then
GetPyChar = "s"
ElseIf (Tmp >= 52218 And Tmp <= 52697) Then
GetPyChar = "t"
ElseIf (Tmp >= 52698 And Tmp <= 52979) Then
GetPyChar = "w"
ElseIf (Tmp >= 52980 And Tmp <= 53688) Then
GetPyChar = "x"
ElseIf (Tmp >= 53689 And Tmp <= 54480) Then
GetPyChar = "y"
ElseIf (Tmp >= 54481 And Tmp <= 62289) Then
GetPyChar = "z"
Else '如果不是中文,则不处理
GetPyChar = char
End If
End Function
Sub window_onload
MsgBox GetPyChar("<%=session("wtr")%>")
End sub
</script>
<%=session("wtr")%>
上面的代码是将汉字的首位转成拼音的代码
<%session("wtr")="中"%> 是我定义的一个汉字“中”
代码执行后通过MSGBOX弹出来的结果是“Z”但是我在网页中直接显示
<%=session("wtr")%>仍然是“中”字,并没有通过vbscript将汉字的首拼取出来,试了一天了都没有结果,望高手指点一下!
如果是客户端运行的,那我怎么把结果存到数据库中啊
谁能修改一下这个vbscript的代码,让它把处理完的结果返回给session啊
或者告诉我一个方法,可以把这个vbscript处理的结果rs("")到数据库中! 展开
<script language=vbscript>
'转换拼音
Public Function GetPyChar(char)
On Error Resume Next
Dim Tmp
Tmp = 65536 + Asc(char)
If Tmp = 53687 Then
GetPyChar = "s"
Exit Function
End If
If (Tmp >= 45217 And Tmp <= 45252) Then
GetPyChar = "a"
ElseIf (Tmp >= 45253 And Tmp <= 45760) Then
GetPyChar = "b"
ElseIf (Tmp >= 45761 And Tmp <= 46317) Then
GetPyChar = "c"
ElseIf (Tmp >= 46318 And Tmp <= 46825) Then
GetPyChar = "d"
ElseIf (Tmp >= 46826 And Tmp <= 47009) Then
GetPyChar = "e"
ElseIf (Tmp >= 47010 And Tmp <= 47296) Then
GetPyChar = "f"
ElseIf (Tmp >= 47297 And Tmp <= 47613) Then
GetPyChar = "g"
ElseIf (Tmp >= 47614 And Tmp <= 48118) Then
GetPyChar = "h"
ElseIf (Tmp >= 48119 And Tmp <= 49061) Then
GetPyChar = "j"
ElseIf (Tmp >= 49062 And Tmp <= 49323) Then
GetPyChar = "k"
ElseIf (Tmp >= 49324 And Tmp <= 49895) Then
GetPyChar = "l"
ElseIf (Tmp >= 49896 And Tmp <= 50370) Then
GetPyChar = "m"
ElseIf (Tmp >= 50371 And Tmp <= 50613) Then
GetPyChar = "n"
ElseIf (Tmp >= 50614 And Tmp <= 50621) Then
GetPyChar = "o"
ElseIf (Tmp >= 50622 And Tmp <= 50905) Then
GetPyChar = "p"
ElseIf (Tmp >= 50906 And Tmp <= 51386) Then
GetPyChar = "q"
ElseIf (Tmp >= 51387 And Tmp <= 51445) Then
GetPyChar = "r"
ElseIf (Tmp >= 51446 And Tmp <= 52217) Then
GetPyChar = "s"
ElseIf (Tmp >= 52218 And Tmp <= 52697) Then
GetPyChar = "t"
ElseIf (Tmp >= 52698 And Tmp <= 52979) Then
GetPyChar = "w"
ElseIf (Tmp >= 52980 And Tmp <= 53688) Then
GetPyChar = "x"
ElseIf (Tmp >= 53689 And Tmp <= 54480) Then
GetPyChar = "y"
ElseIf (Tmp >= 54481 And Tmp <= 62289) Then
GetPyChar = "z"
Else '如果不是中文,则不处理
GetPyChar = char
End If
End Function
Sub window_onload
MsgBox GetPyChar("<%=session("wtr")%>")
End sub
</script>
<%=session("wtr")%>
上面的代码是将汉字的首位转成拼音的代码
<%session("wtr")="中"%> 是我定义的一个汉字“中”
代码执行后通过MSGBOX弹出来的结果是“Z”但是我在网页中直接显示
<%=session("wtr")%>仍然是“中”字,并没有通过vbscript将汉字的首拼取出来,试了一天了都没有结果,望高手指点一下!
如果是客户端运行的,那我怎么把结果存到数据库中啊
谁能修改一下这个vbscript的代码,让它把处理完的结果返回给session啊
或者告诉我一个方法,可以把这个vbscript处理的结果rs("")到数据库中! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询