-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.html
62 lines (56 loc) · 1.76 KB
/
demo.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>简体-繁体-切换</title>
<meta name="description" content="">
<meta name="keywords" content="">
</head>
<body>
<section class="sim">
简体文字 体体体体体体喵喵喵冲突部分
</section>
<section class="trad">
繁体文字 体体体体体体
</section>
<!-- 混合 -->
<section>
<p class="sim">简体文字 体体体体体体</p>
<p class="trad">繁体文字 体体体体体体</p>
<p class="sim">简体文字 体体体体体体</p>
<p class="trad">繁体文字 体体体体体体</p>
</section>
<section class="trad">
<p>繁体文字
<span>体体体体体体</span>
<a href="#">体体</a>
<input type="text" name="" value="体体">
</p>
</section>
<input class="trad" type="text" name="" value="体体">
<a href="javascript:stSwitch.changeText()">切换</a>
<section>
<textarea class="trad" type="text" value="" style="width: 300px;height: 100px;resize:none">体体体体体体</textarea>
<div>
<a href="javascript:stSwitch.simtradSwitch('sim',text)">转换为简体字</a>
<a href="javascript:stSwitch.simtradSwitch('trad',text)">转换为繁体字</a>
</div>
</section>
<script src="js/sim-trad-switch.js"></script>
<script type="text/javascript">
var stSwitch = new stSwitch({
switch: true,
debug: true,
callback: function(res){
console.log(res);
}
});
var text = document.querySelector("textarea");
// 直接调用
var str = "体体体体体体";
var str_trad = stSwitch.simtradSwitch('trad',str);
console.log(str_trad);
</script>
</body>
</html>