/ Published in: JavaScript
Replace English numbers with Arabic numbers in browsers supporting Unicode & JavaScript.
Credits to
http://www.swalif.net/softs/swalif54/softs232281/
Credits to
http://www.swalif.net/softs/swalif54/softs232281/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var replaceDigits = function() { var map = [ "&\#1632;","&\#1633;","&\#1634;","&\#1635;","&\#1636;", "&\#1637;","&\#1638;","&\#1639;","&\#1640;","&\#1641;" ] 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>
URL: http://www.swalif.net/softs/swalif54/softs232281/