一个取汉字的首字母的 asp代码

  1. <%
  2. function getpychar(char
  3. dim tmp 
  4. tmp=65536+asc(char
  5. if(tmp>=45217 and tmp<=45252) then 
  6. getpychar= "A" 
  7. elseif(tmp>=45253 and tmp<=45760) then 
  8. getpychar= "B" 
  9. elseif(tmp>=45761 and tmp<=46317) then 
  10. getpychar= "C" 
  11. elseif(tmp>=46318 and tmp<=46825) then 
  12. getpychar= "D" 
  13. elseif(tmp>=46826 and tmp<=47009) then 
  14. getpychar= "E" 
  15. elseif(tmp>=47010 and tmp<=47296) then 
  16. getpychar= "F" 
  17. elseif(tmp>=47297 and tmp<=47613) then 
  18. getpychar= "G" 
  19. elseif(tmp>=47614 and tmp<=48118) then 
  20. getpychar= "H" 
  21. elseif(tmp>=48119 and tmp<=49061) then 
  22. getpychar= "J" 
  23. elseif(tmp>=49062 and tmp<=49323) then 
  24. getpychar= "K" 
  25. elseif(tmp>=49324 and tmp<=49895) then 
  26. getpychar= "L" 
  27. elseif(tmp>=49896 and tmp<=50370) then 
  28. getpychar= "M" 
  29. elseif(tmp>=50371 and tmp<=50613) then 
  30. getpychar= "N" 
  31. elseif(tmp>=50614 and tmp<=50621) then 
  32. getpychar= "O" 
  33. elseif(tmp>=50622 and tmp<=50905) then 
  34. getpychar= "P" 
  35. elseif(tmp>=50906 and tmp<=51386) then 
  36. getpychar= "Q" 
  37. elseif(tmp>=51387 and tmp<=51445) then 
  38. getpychar= "R" 
  39. elseif(tmp>=51446 and tmp<=52217) then 
  40. getpychar= "S" 
  41. elseif(tmp>=52218 and tmp<=52697) then 
  42. getpychar= "T" 
  43. elseif(tmp>=52698 and tmp<=52979) then 
  44. getpychar= "W" 
  45. elseif(tmp>=52980 and tmp<=53688) then 
  46. getpychar= "X" 
  47. elseif(tmp>=53689 and tmp<=54480) then 
  48. getpychar= "Y" 
  49. elseif(tmp>=54481 and tmp<=62289) then 
  50. getpychar= "Z" 
  51. else '如果不是中文,则不处理 
  52. getpychar=char 
  53. end if 
  54. end function 
  55. function getpy(str) 
  56. dim ret 
  57. for i=1 to len(str)
  58. ret=ret&getpychar(mid(str,i,1))
  59. next
  60. getpy=ret
  61. end function
  62. '这是使用的例子
  63. response.write getpy("我需要要测试一下")
  64. %>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的商城页面代码示例,使用了 ASP 和 iframe: ``` <%@ Language=VBScript %> <html> <head> <title>商城页面</title> </head> <body> <h1>欢迎来到我们的商城</h1> <iframe src="menu.asp" name="menu" width="150" height="500"></iframe> <iframe src="products.asp" name="main" width="500" height="500"></iframe> </body> </html> ``` 上面的代码包含两个 iframe 标签,一个用于显示菜单,另一个用于显示产品。您需要创建两个 ASP 页面:menu.asp 和 products.asp。 menu.asp 页面应该包含商城的菜单,例如: ``` <%@ Language=VBScript %> <ul> <li><a href="products.asp?category=books" target="main">图书</a></li> <li><a href="products.asp?category=electronics" target="main">电子产品</a></li> <li><a href="products.asp?category=clothing" target="main">服装</a></li> </ul> ``` 上面的代码创建了一个简单的菜单,其中每个链接都指向 products.asp 页面,并传递一个 category 参数,以指定要显示哪种类型的产品。 products.asp 页面应该根据传递的 category 参数显示相应的产品列表,例如: ``` <%@ Language=VBScript %> <% Dim category category = Request.QueryString("category") Select Case category Case "books" Response.Write("<h2>图书</h2>") Response.Write("<ul>") Response.Write("<li>书名1</li>") Response.Write("<li>书名2</li>") Response.Write("<li>书名3</li>") Response.Write("</ul>") Case "electronics" Response.Write("<h2>电子产品</h2>") Response.Write("<ul>") Response.Write("<li>产品1</li>") Response.Write("<li>产品2</li>") Response.Write("<li>产品3</li>") Response.Write("</ul>") Case "clothing" Response.Write("<h2>服装</h2>") Response.Write("<ul>") Response.Write("<li>衣服1</li>") Response.Write("<li>衣服2</li>") Response.Write("<li>衣服3</li>") Response.Write("</ul>") Case Else Response.Write("<h2>请选择一个分类</h2>") End Select %> ``` 上面的代码根据传递的 category 参数显示相应的产品列表。您可以根据需要修改此代码,以显示您自己的产品数据。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值