爱问知识人 爱问教育 医院库

JS代码如何实现汉字按拼音排序呢?

首页

JS代码如何实现汉字按拼音排序呢?

JS代码如何实现汉字按拼音排序呢?

提交回答

全部答案

    2018-10-28 00:44:45
  •   htmlheadtitle汉字排序-学无忧(www。xue51。com)/titlescript language=javascript  function txtSort() { var txtarray=document。getElementById(txt)。
      value; //获取排序前的文本 txtarray=txtarray。split(,); //通过间隔符号,将文本分割成数组 txtarray。sort(); //对数组进行排序 txtarray。sort(function(txtarray,b){ return txtarray。
      localeCompare(b) //使用localeCompare进行2个文本的对比 }); document。getElementById(txt2)。
      value=txtarray; //显示排序后的结果 }/script/headbody排序前:textarea id=txt 占三,里斯,亚当,苹果,香蕉,政治,历史/textarea/pinput type=button id=Button1 value=排序 onclick=txtSort()//p排序后:textarea id=txt2 /textarea/p/body/html。

    没***

    2018-10-28 00:44:45

类似问题

换一换

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):