文章分类 | 软件分类 | 最新软件 | 杀毒软件 | 实用软件  | MTV下载  | 设为首页 |
  | 下载分类 | 最近更新
您的位置: 首页 >> 文章首页 >> 技术开发 >> Script >> JavaScript >>  
JavaScript点击TOP10
·Javascript实例教程20 OLE Automation72006-2-9 16:53:32
·在状态栏中实现活动文字效果2006-2-9 16:52:11
·对联广告JS代码效果大全2006-2-9 16:28:20
·JavaScript修改注册表的例子2006-2-5 13:12:05
·到亿位的金额小写转大写JS代码2006-2-9 16:19:28
·延迟 定时 强制弹出代码2006-2-9 16:16:19
·初学Javascript之cookie篇译2006-2-9 16:54:14
·打开页面就是全屏的方法2006-2-9 14:51:11
·HTML语言剖析(十五)调色原理2006-2-9 16:54:43
·控制输出字符串长度区别中英文2006-2-5 13:14:14
Script点击TOP10
·Javascript实例教程20 OLE Automation72006-2-9 16:53:32
·男人娶“第二眼美女”2006-2-6 7:30:38
·使用VBScript操作Html复选框(CheckBox)控件2006-2-9 18:20:19
·有了“故障一查通” 电脑有毛病再不用愁了2006-2-6 0:07:24
·GUI也有奥运会?超豪华Windows桌面主题推荐2006-2-6 6:35:52
·深入核心 挖掘IE浏览器的潜在功能2006-2-5 18:27:12
·打开页面就是全屏的方法2006-2-9 14:51:11
·初学Javascript之cookie篇译2006-2-9 16:54:14
·软件删除常见疑难故障处理办法荟萃2006-2-5 23:50:39
·在状态栏中实现活动文字效果2006-2-9 16:52:11

 

获取中文字符串拼音首字母串的函数
作者:我去下载           时间:2006-2-9 19:05:30


<script language=javascript>
cntext=window.prompt("请输入中文:");
</script>

<script language=vbs>
function getpychar(char)
tmp=65536+asc(char)
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<=53640) 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
function getpy(str)
for i=1 to len(str)
getpy=getpy&getpychar(mid(str,i,1))
next
end function

alert(cntext&"的首字母是:"&getpychar(cntext))
</script>
分页:
相关文章:
Copyright© 2005-2006 wqxz.com, All Rights Reserved. 购买虚拟主机请与本站联系