-
Notifications
You must be signed in to change notification settings - Fork 8
/
hanzi.html
48 lines (41 loc) · 1.32 KB
/
hanzi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html manifest="pinyin.manifest">
<head>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>汉字到拼音</title>
</head>
<link rel="stylesheet" type="text/css" href="pinyin.css">
<body>
<nav>
<a class="nav-link" href="hanzi.html">汉字学习</a>
<a class="nav-link" href="pinyin.html">拼音学习</a>
</nav>
<div class="container">
<input type="text" placeholder="在此处输入要学习的汉字" id="pyText" onchange="textchanged();" onkeyup="textchanged();">
<div id="pySelect"></div>
<div id="pyShow"></div>
<audio id="pymp3" src=""></audio>
</div>
<script src="pydic.js"></script>
<script src="pymp3.js"></script>
<script src="query.js"></script>
<script type="text/javascript">
function textchanged() {
var text = document.getElementById("pyText").value;
var pys = getPinyin(text);
show(pys);
}
function getPinyin(text) {
var ret = [];
for (var i = 0; i < text.length; i++) {
var py = pyDic[text[i]];
if (py) {
ret.push(py);
}
}
return ret;
}
</script>
</body>
</html>