一个关于ASP汉字转拼音的问题!
<%functiongetpychar(char)dimtmpp:tmpp=65536+asc(char)if(tmpp>=45217andtmpp<=45252)the...
<%
function getpychar(char)
dim tmpp:tmpp=65536+asc(char)
if(tmpp>=45217 and tmpp<=45252) then
getpychar= "A"
elseif(tmpp>=45253 and tmpp<=45760) then
getpychar= "B"
elseif(tmpp>=45761 and tmpp<=46317) then
getpychar= "C"
elseif(tmpp>=46318 and tmpp<=46825) then
getpychar= "D"
elseif(tmpp>=46826 and tmpp<=47009) then
getpychar= "E"
elseif(tmpp>=47010 and tmpp<=47296) then
getpychar= "F"
elseif(tmpp>=47297 and tmpp<=47613) then
getpychar= "G"
elseif(tmpp>=47614 and tmpp<=48118) then
getpychar= "H"
elseif(tmpp>=48119 and tmpp<=49061) then
getpychar= "J"
elseif(tmpp>=49062 and tmpp<=49323) then
getpychar= "K"
elseif(tmpp>=49324 and tmpp<=49895) then
getpychar= "L"
elseif(tmpp>=49896 and tmpp<=50370) then
getpychar= "M"
elseif(tmpp>=50371 and tmpp<=50613) then
getpychar= "N"
elseif(tmpp>=50614 and tmpp<=50621) then
getpychar= "O"
elseif(tmpp>=50622 and tmpp<=50905) then
getpychar= "P"
elseif(tmpp>=50906 and tmpp<=51386) then
getpychar= "Q"
elseif(tmpp>=51387 and tmpp<=51445) then
getpychar= "R"
elseif(tmpp>=51446 and tmpp<=52217) then
getpychar= "S"
elseif(tmpp>=52218 and tmpp<=52697) then
getpychar= "T"
elseif(tmpp>=52698 and tmpp<=52979) then
getpychar= "W"
elseif(tmpp>=52980 and tmpp<=53640) then
getpychar= "X"
elseif(tmpp>=53689 and tmpp<=54480) then
getpychar= "Y"
elseif(tmpp>=54481 and tmpp<=62289) then
getpychar= "Z"
else '如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
pystr=pystr & getpychar(mid(str,i,1))
next
getpy=lcase(pystr)
end function
zhoz_str = getpy(request.form("zhoz_txt"))
pingying = RTrim(zhoz_str)
%>
<form method=post action="test2.asp">
请在此处输入中文:<input name="zhoz_txt" value="" />
<INPUT TYPE="submit" value="转换为拼音" />
</form>
---------------------------------------------------------
上面是一个 汉字 转 拼音首字母的 转换程序
我想将 生成的 拼音字母 传入 test2.asp 这个页面,
test2.asp 应该怎么写?或者 前面那道程序该怎么写? 展开
function getpychar(char)
dim tmpp:tmpp=65536+asc(char)
if(tmpp>=45217 and tmpp<=45252) then
getpychar= "A"
elseif(tmpp>=45253 and tmpp<=45760) then
getpychar= "B"
elseif(tmpp>=45761 and tmpp<=46317) then
getpychar= "C"
elseif(tmpp>=46318 and tmpp<=46825) then
getpychar= "D"
elseif(tmpp>=46826 and tmpp<=47009) then
getpychar= "E"
elseif(tmpp>=47010 and tmpp<=47296) then
getpychar= "F"
elseif(tmpp>=47297 and tmpp<=47613) then
getpychar= "G"
elseif(tmpp>=47614 and tmpp<=48118) then
getpychar= "H"
elseif(tmpp>=48119 and tmpp<=49061) then
getpychar= "J"
elseif(tmpp>=49062 and tmpp<=49323) then
getpychar= "K"
elseif(tmpp>=49324 and tmpp<=49895) then
getpychar= "L"
elseif(tmpp>=49896 and tmpp<=50370) then
getpychar= "M"
elseif(tmpp>=50371 and tmpp<=50613) then
getpychar= "N"
elseif(tmpp>=50614 and tmpp<=50621) then
getpychar= "O"
elseif(tmpp>=50622 and tmpp<=50905) then
getpychar= "P"
elseif(tmpp>=50906 and tmpp<=51386) then
getpychar= "Q"
elseif(tmpp>=51387 and tmpp<=51445) then
getpychar= "R"
elseif(tmpp>=51446 and tmpp<=52217) then
getpychar= "S"
elseif(tmpp>=52218 and tmpp<=52697) then
getpychar= "T"
elseif(tmpp>=52698 and tmpp<=52979) then
getpychar= "W"
elseif(tmpp>=52980 and tmpp<=53640) then
getpychar= "X"
elseif(tmpp>=53689 and tmpp<=54480) then
getpychar= "Y"
elseif(tmpp>=54481 and tmpp<=62289) then
getpychar= "Z"
else '如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
pystr=pystr & getpychar(mid(str,i,1))
next
getpy=lcase(pystr)
end function
zhoz_str = getpy(request.form("zhoz_txt"))
pingying = RTrim(zhoz_str)
%>
<form method=post action="test2.asp">
请在此处输入中文:<input name="zhoz_txt" value="" />
<INPUT TYPE="submit" value="转换为拼音" />
</form>
---------------------------------------------------------
上面是一个 汉字 转 拼音首字母的 转换程序
我想将 生成的 拼音字母 传入 test2.asp 这个页面,
test2.asp 应该怎么写?或者 前面那道程序该怎么写? 展开
1个回答
展开全部
<form method=post action="test2.asp">
请在此处输入中文:<input name="zhoz_txt" value="" />
<INPUT TYPE="submit" value="转换为拼音" />
</form>
//////这段代码是在test2.asp中么?如果是 那么在这段后面
zhoz_str = getpy(request.form("zhoz_txt"))
pingying = RTrim(zhoz_str)
添加如下代码 response.write(pingying)
//////////如果不是那么要想根据输入的汉子转拼音再将拼音发送到里一个页面时需要用ajax来实现 我就难得给你打字了哈 通过两个页面也可以实现
1.asp 代码
<form method=post action="test2.asp">
请在此处输入中文:<input type=text name="zhoz_txt" value="" />
<INPUT TYPE="submit" value="转换为拼音" />
</form>
test2.asp 代码
<%
function getpychar(char)
dim tmpp:tmpp=65536+asc(char)
if(tmpp>=45217 and tmpp<=45252) then
getpychar= "A"
elseif(tmpp>=45253 and tmpp<=45760) then
getpychar= "B"
elseif(tmpp>=45761 and tmpp<=46317) then
getpychar= "C"
elseif(tmpp>=46318 and tmpp<=46825) then
getpychar= "D"
elseif(tmpp>=46826 and tmpp<=47009) then
getpychar= "E"
elseif(tmpp>=47010 and tmpp<=47296) then
getpychar= "F"
elseif(tmpp>=47297 and tmpp<=47613) then
getpychar= "G"
elseif(tmpp>=47614 and tmpp<=48118) then
getpychar= "H"
elseif(tmpp>=48119 and tmpp<=49061) then
getpychar= "J"
elseif(tmpp>=49062 and tmpp<=49323) then
getpychar= "K"
elseif(tmpp>=49324 and tmpp<=49895) then
getpychar= "L"
elseif(tmpp>=49896 and tmpp<=50370) then
getpychar= "M"
elseif(tmpp>=50371 and tmpp<=50613) then
getpychar= "N"
elseif(tmpp>=50614 and tmpp<=50621) then
getpychar= "O"
elseif(tmpp>=50622 and tmpp<=50905) then
getpychar= "P"
elseif(tmpp>=50906 and tmpp<=51386) then
getpychar= "Q"
elseif(tmpp>=51387 and tmpp<=51445) then
getpychar= "R"
elseif(tmpp>=51446 and tmpp<=52217) then
getpychar= "S"
elseif(tmpp>=52218 and tmpp<=52697) then
getpychar= "T"
elseif(tmpp>=52698 and tmpp<=52979) then
getpychar= "W"
elseif(tmpp>=52980 and tmpp<=53640) then
getpychar= "X"
elseif(tmpp>=53689 and tmpp<=54480) then
getpychar= "Y"
elseif(tmpp>=54481 and tmpp<=62289) then
getpychar= "Z"
else '如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
pystr=pystr & getpychar(mid(str,i,1))
next
getpy=lcase(pystr)
end function
zhoz_str = getpy(request.form("zhoz_txt"))
pingying = RTrim(zhoz_str)
response.write(zhoz_str&"转化拼音为:"&pingying)
%>
请在此处输入中文:<input name="zhoz_txt" value="" />
<INPUT TYPE="submit" value="转换为拼音" />
</form>
//////这段代码是在test2.asp中么?如果是 那么在这段后面
zhoz_str = getpy(request.form("zhoz_txt"))
pingying = RTrim(zhoz_str)
添加如下代码 response.write(pingying)
//////////如果不是那么要想根据输入的汉子转拼音再将拼音发送到里一个页面时需要用ajax来实现 我就难得给你打字了哈 通过两个页面也可以实现
1.asp 代码
<form method=post action="test2.asp">
请在此处输入中文:<input type=text name="zhoz_txt" value="" />
<INPUT TYPE="submit" value="转换为拼音" />
</form>
test2.asp 代码
<%
function getpychar(char)
dim tmpp:tmpp=65536+asc(char)
if(tmpp>=45217 and tmpp<=45252) then
getpychar= "A"
elseif(tmpp>=45253 and tmpp<=45760) then
getpychar= "B"
elseif(tmpp>=45761 and tmpp<=46317) then
getpychar= "C"
elseif(tmpp>=46318 and tmpp<=46825) then
getpychar= "D"
elseif(tmpp>=46826 and tmpp<=47009) then
getpychar= "E"
elseif(tmpp>=47010 and tmpp<=47296) then
getpychar= "F"
elseif(tmpp>=47297 and tmpp<=47613) then
getpychar= "G"
elseif(tmpp>=47614 and tmpp<=48118) then
getpychar= "H"
elseif(tmpp>=48119 and tmpp<=49061) then
getpychar= "J"
elseif(tmpp>=49062 and tmpp<=49323) then
getpychar= "K"
elseif(tmpp>=49324 and tmpp<=49895) then
getpychar= "L"
elseif(tmpp>=49896 and tmpp<=50370) then
getpychar= "M"
elseif(tmpp>=50371 and tmpp<=50613) then
getpychar= "N"
elseif(tmpp>=50614 and tmpp<=50621) then
getpychar= "O"
elseif(tmpp>=50622 and tmpp<=50905) then
getpychar= "P"
elseif(tmpp>=50906 and tmpp<=51386) then
getpychar= "Q"
elseif(tmpp>=51387 and tmpp<=51445) then
getpychar= "R"
elseif(tmpp>=51446 and tmpp<=52217) then
getpychar= "S"
elseif(tmpp>=52218 and tmpp<=52697) then
getpychar= "T"
elseif(tmpp>=52698 and tmpp<=52979) then
getpychar= "W"
elseif(tmpp>=52980 and tmpp<=53640) then
getpychar= "X"
elseif(tmpp>=53689 and tmpp<=54480) then
getpychar= "Y"
elseif(tmpp>=54481 and tmpp<=62289) then
getpychar= "Z"
else '如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
pystr=pystr & getpychar(mid(str,i,1))
next
getpy=lcase(pystr)
end function
zhoz_str = getpy(request.form("zhoz_txt"))
pingying = RTrim(zhoz_str)
response.write(zhoz_str&"转化拼音为:"&pingying)
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询