在支持Unicode和JavaScript的浏览器中显示阿拉伯数字
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在支持Unicode和JavaScript的浏览器中显示阿拉伯数字相关的知识,希望对你有一定的参考价值。
Replace English numbers with Arabic numbers in browsers supporting Unicode & javascript.Credits to
http://www.swalif.net/softs/swalif54/softs232281/
var replaceDigits = function() { var map = [ "٠","١","٢","٣","٤", "٥","٦","٧","٨","٩" ] document.body.innerhtml = document.body.innerHTML.replace( /d(?=[^<>]*(<|$))/g, function($0) { return map[$0] } ); } Example in how to use: <!-- in the head tag of the page you want --> <head> <script type="text/javascript"> window.onload = replaceDigits </script> </head>
以上是关于在支持Unicode和JavaScript的浏览器中显示阿拉伯数字的主要内容,如果未能解决你的问题,请参考以下文章