Home  >  Article  >  Web Front-end  >  JS implements methods to obtain various pinyin types

JS implements methods to obtain various pinyin types

小云云
小云云Original
2017-12-21 10:22:272116browse

This article mainly introduces the method of JS to obtain the pinyin, full pinyin and mixed pinyin of the first letter of Chinese characters. It involves the use of ChinesePY.js plug-in and event response related operation skills. Friends who need it can refer to it. I hope it can help everyone. .

The running effect is as follows:

Complete sample code:


<!DOCTYPE HTML>
<html>
<head>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" src="ChinesePY.js"></script>
  </head>
  <body style="font-size:12px">
    <form>
      输入内容: <input type="text" onkeyup="pym.innerHTML = Pinyin.GetJP(this.value);allpym.innerHTML=Pinyin.GetQP(this.value);
        staffpym.innerHTML=Pinyin.GetHP(this.value);" /> <br /><br />
      拼 音 码: <span id="pym"></span><br /><br />
      拼音全码: <span id="allpym"></span><br /><br />
      混 拼 码: <span id="staffpym"></span>
    </form>
  </body>
</html>

Have you learned it? If it is useful, collect it quickly.

Related recommendations:

Case analysis of php obtaining the first letters of Chinese characters and implementing grouping sorting

How to obtain Chinese pinyin in Java Introduction to the method of initial letters

php realizes the conversion of Chinese characters into pinyin and the sharing of examples of the first letters of each Chinese character

The above is the detailed content of JS implements methods to obtain various pinyin types. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn