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

JS implements methods to obtain various pinyin types

小云云
Release: 2017-12-21 10:22:27
Original
2137 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template