下面是我在网上找到的一个asp 汉字转换成拼音的代码 请高手看看怎么让它在文本框中显示?
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=GB2312"/><script...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<script language="JavaScript">
<!--
//汉字拼音首字母列表 本列表包含了20902个汉字,用于配合 ToChineseSpell
//函数使用,本表收录的字符的Unicode编码范围为19968至40869, XDesigner 整理
省略。。。。
//参数,中文字符串
//返回值:拼音首字母串数组
function makePy(str){
function checkCh(ch){
<script language="JavaScript">
<!--
function getPosition(obj) {
var top=0;
var left=0;
var width=obj.offsetWidth;
var height=obj.offsetHeight;
while (obj.offsetParent) {
top += obj.offsetTop;
left += obj.offsetLeft;
obj = obj.offsetParent;
}
return {"top":top,"left":left,"width":width,"height":height};
}
function query(){
var str = document.getElementById("txtChinese").value.trim();
if(str == "") return;
var arrRslt = makePy(str);
var div = document.getElementById("divResult");
div.style.position = "absolute";
div.style.display = "block" ;
div.innerHTML =arrRslt.join("</div><div> ");
var oDiv = getPosition(document.getElementById("txtChinese"));
div.style.top = oDiv.top + oDiv.height;
div.style.left = oDiv.left ;
div.style.width = oDiv.width ;
var divs = div.getElementsByTagName("div");
for(var i=0;i<divs.length;i++){
divs[i].className = i%2 ? "divShuang" : "divDan";
}
}
//-->
</script>
</head>
<body>
<table width="800" cellspacing="0" cellpadding="8" align="center" >
<tr>
<td width="80%"><span>请输入中文字符串:</span><input type="text" id="txtChinese" size="30" onkeyup="query()(this.value);">
<input type="text" name="qhtext" id="qhtext" size="20"></td>
</tr>
</table><div id="divResult"></div>
</body>
</html> 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<script language="JavaScript">
<!--
//汉字拼音首字母列表 本列表包含了20902个汉字,用于配合 ToChineseSpell
//函数使用,本表收录的字符的Unicode编码范围为19968至40869, XDesigner 整理
省略。。。。
//参数,中文字符串
//返回值:拼音首字母串数组
function makePy(str){
function checkCh(ch){
<script language="JavaScript">
<!--
function getPosition(obj) {
var top=0;
var left=0;
var width=obj.offsetWidth;
var height=obj.offsetHeight;
while (obj.offsetParent) {
top += obj.offsetTop;
left += obj.offsetLeft;
obj = obj.offsetParent;
}
return {"top":top,"left":left,"width":width,"height":height};
}
function query(){
var str = document.getElementById("txtChinese").value.trim();
if(str == "") return;
var arrRslt = makePy(str);
var div = document.getElementById("divResult");
div.style.position = "absolute";
div.style.display = "block" ;
div.innerHTML =arrRslt.join("</div><div> ");
var oDiv = getPosition(document.getElementById("txtChinese"));
div.style.top = oDiv.top + oDiv.height;
div.style.left = oDiv.left ;
div.style.width = oDiv.width ;
var divs = div.getElementsByTagName("div");
for(var i=0;i<divs.length;i++){
divs[i].className = i%2 ? "divShuang" : "divDan";
}
}
//-->
</script>
</head>
<body>
<table width="800" cellspacing="0" cellpadding="8" align="center" >
<tr>
<td width="80%"><span>请输入中文字符串:</span><input type="text" id="txtChinese" size="30" onkeyup="query()(this.value);">
<input type="text" name="qhtext" id="qhtext" size="20"></td>
</tr>
</table><div id="divResult"></div>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询