js汉字转换拼音

编程入门 行业动态 更新时间:2024-10-28 12:23:00

js<a href=https://www.elefans.com/category/jswz/34/1769833.html style=汉字转换拼音"/>

js汉字转换拼音

测试中有些多音字不是能很好的支持,汉字对应的拼音在pinyin.dict.src.js中

<!DOCTYPE html>
<html xmlns="" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="generator" content="gvim" />
<meta name="author" content="闲耘 (mail[AT]xianyun)" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<style type="text/css" media="screen">
#pin,#pin2{border:1px solid #ccc;pidding:5px;white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap;word-wrap:break-word; word-break:normal;
}
</style>
<title>Pinyin</title>
</head>
<body><div><textarea id="han" name="han" rows="8" cols="40">天将降大任于斯人也。This is a test for English.</textarea></div>
回车看效果:
<div id="pin"></div>
<hr /><script id="src-dict" type="text/javascript" src="pinyin.dict.src.js"></script>
<!--注意:不要同时导入多个词典库,否则多音字组合时性能非常成问题。-->
<!--<script type="text/javascript" src="pinyin.tone.src.js"></script>-->
<!--<script type="text/javascript" src="pinyin.tone2.src.js"></script>-->
<script type="text/javascript" src="pinyin.js"></script>
<script type="text/javascript">/*<![CDATA[*/function $(id){return document.getElementById(id);}$("han").onkeyup = function(){$("pin").innerHTML = pinyin(this.value, true, ",");};
/*]]>*/</script>
</body>
</html>

 

 

更多推荐

js汉字转换拼音

本文发布于:2024-03-06 18:23:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1716040.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:汉字   拼音   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!