使用转换js:
transform.js : https://blog-static.cnblogs.com/files/namedL/transform.js
调用:
<body> <span id="s1">偏東風,風力(級) 4級陣風6級以下上午轉4至5陣風7級</span> -->转换为简体 <span id="s2"></span><br /> <span id="s3">偏东风,风力(级) 4级阵风6级以下上午转4至5阵风7级</span> -->转换为繁体 <span id="s4"></span> </body> <script src="transform.js"></script> <script> var s1 = document.getElementById("s1"); var s2 = document.getElementById("s2"); s2.innerHTML = t2s(s1.innerHTML); var s3 = document.getElementById("s3"); var s4 = document.getElementById("s4"); s4.innerHTML = s2t(s3.innerHTML); </script> </html>
效果: