dojo.number/currency

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>Tutorial: Hello Dojo!</title>
<style type="text/css">
@import "../dojoroot/dijit/themes/tundra/tundra.css";
@import
"../dojoroot/dojo/resources/dojo.css"
</style>
<script type="text/javascript" src="../dojoroot/dojo/dojo.js"
	djConfig="parseOnLoad: true,isDebug:true"></script>
<script type="text/javascript">
	dojo.addOnLoad(function() {
		require([ "dojo/number" ], function(number) {
			// Returns a string, in locale format, with 2 decimal places
			var num = number.format(0.34567, {
				places : 2,// 精度
				round : 0,// 5,-1 四舍五入
				fractional : true,//显示小数
				type : "currency"//"decimal", "scientific", "percent","currency", and "decimal". "decimal"

			});
			alert(num);
		});
		require([ "dojo/currency" ], function(number) {
			// Returns a string, in locale format, with 2 decimal places
			var num = number.format(10000.34567, {
				currency:"USD",
				symbol:"$"
			});
			alert(num);
		});
	});
</script>
</head>
<body class="tundra">

</body>
</html>

你可能感兴趣的:(dojo.number/currency)