批处理之家's Archiver

youxi01 发表于 2008-9-21 02:29

汉字区位码查询[hta]

一个用来查询汉字区位码的小东西

源代码:[code]
<!--////////程序说明/////////====
程序名称:汉字区位码查询.hta
程序作者:youxi01
完成日期:2008-9-21
<!--//////////样式////////////-->
<HTA:APPLICATION
SCROLL="no"
INNERBORDER="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
/>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
a:link {color: blue}
a:visited {color: blue}
body  {background: #EEEEEE}
#table {border:none;width:100%;background: #EEEEEE;}
#table td {border:1 solid  #BEBEBE ; height="180"; }
.test {padding: 3px}
.menuUp {
border:1px solid  menu;
height:20px;
}
.menuOver {
padding-top:1px;
border-left:1px solid buttonhighlight;
border-top:1px solid buttonhighlight;
border-right:1px solid buttonshadow;
border-bottom:1px solid buttonshadow;
}
.menuDown {
padding-top:1px;
border-left:1px solid buttonshadow;
border-top:1px solid buttonshadow;
border-right:1px solid buttonhighlight;
border-bottom:1px solid buttonhighlight;
}
</style>
<SCRIPT Language="VBScript">
Sub window_onload
window.resizeTo 380,250
ileft=(window.screen.width-380)/2
itop=(window.screen.height-250)/2
window.moveTo ileft,itop
call query_onclick()
End sub
Function GetCode(str)    '///获取汉字的区位码
    casc=asc(str)
    if casc<0 then casc=casc+65535+1
    if casc>255 then
b2="0"&Right(((casc and 255)-160),2)
b1=Right((int(casc/256)-160),2)
GetCode=b1&Right(b2,2)
    else
GetCode=str
    end if
End Function
Function query_onclick()
    L=len(CN.value)
    for i=1 to L
        Tstr=mid(CN.value,i,1)
if Tstr<>" " then
Tstr="<font color=blue>"&Tstr&"</font>:<font color=green>"&GetCode(Tstr)&"</font>"
Res=Res&Tstr&"</br>"
end if
    next
    Result.innerHTML="查询结果:</br>"&Res
End Function
Function CN_onmouseOver()
me.select
End Function
</SCRIPT>
<title>汉字区位码查询</title>
<body topmargin="2" rightmargin="0" leftmargin="0">
<table id="table" cellpadding="8" cellspacing="5">
    <tr>
      <td width="40%" valign=top>输入汉字:
      <div class="test"><input ID=CN type="text" value="在这里输入汉字" style="BACKGROUND-COLOR: peachpuff;color:#789" size=16></div>
      <div class="test" align=center> <input type="button" ID=query value="点击查询" class="menuUp" onmouseover=me.className='menuOver' onmousedown=me.className='menuDown' onmouseout=me.className='menuUp'></div>
      <div class="test"><fieldset>
     <legend><font color=red>使用说明</font></legend>
     <font size=3px;>1、只能查询GB2312汉字;</br>
     2、可以同时查询多个汉字。</font>
     </fieldset></div>
      </td>
      <td width="59%"><div id=Result style="overflow:auto;height=160">查询结果:</div></td>
    </tr>
</table>
<div align="center">Code by <font color=red>youxi01</font>(2laoshi)
<a href="http://www.2laoshi.cn" target="blank">访问blog</a>
</div>
</body>



[/code]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.