This article illustrates the method of realizing Chinese character ordering by JS. Share to everyone for your reference. as follows:
<script type= "Text/javascript" > <!--function startsort () {var a=document.getelement
Byid (' s '). Value;
A=a.split (', ') a.sort ();
document.getElementById (' R1 '). Value=a;
A.sort (function (a,b) {return a.localecompare (b)});
document.getElementById (' R2 '). Value=a; //--> </script> <p> contains a string array of Chinese characters (comma, "separate"): <br/> <textarea id= "s" style= "width:100%; Overflow:scroll; Word-wrap:normal "rows=" > Angela Han, b soil, abort, Jacky Cheung, something, Apple, May days, Andy Lau, Banana, apple, Fanfan qi, Asan </textarea></p > <p style= "text-align:center" ><input type= button "value=" Sort Test "onclick=" Startsort () "style=" width: 300px "/></p> <p> default sort result: <br/> <textarea id=" R1 "style=" width:100%; Overflow:scroll; Word-wrap:normal "rows=" ></textarea></p> <p> Chinese Pinyin order result: <br/> <textarea id= "R2" Style= "width:100%; Overflow:scroll; Word-wrap:normal "rows=" ></textarea></p>
The
wants this article to help you with your JavaScript programming.