Javascript »õ±Ò¸ñʽ»¯º¯Êý
ƽʱÎÒÃÇÓпÉÄÜÓöµ½ÐèÒª°ÑÍøÕ¾ÖеÄÊý×Ö£¨Í¨³£ÊǼ۸ñ£©ÓÃÒ»ÖÖͳһµÄ·½Ê½ÏÔʾ³öÀ´£¬±ÈÈçÿ¸ô3¸ö×Ö·û¼ÓÒ»¸ö¿Õ¸ñ¡£Èç¹ûÊýÖµ±È½Ï´óµÄ»°ÕâÖÖ·½·¨ºÜÓÐÀûÓÚÓû§ÔĶÁ¡£
ÓÃXSLTµÄÅóÓÑ¿ÉÄÜÖªµÀÔÚXSLÖпÉÒÔÓÃÈçÏ´úÂëʵÏÖ
<xsl:decimal-format name="currency" decimal-separator="." grouping-separator=" "/>
½ñÌìÑо¿ÁËһϣ¬Ð´ÁËÒ»¸ö¶ÔÓ¦µÄjavascript´úÂë.
ÓÐȤµÄ²¿·ÖÊÇ·½·¨¶þÊÇÓÃÕýÔò±í´ïʽʵÏֵģ¬·Ç³£Ã÷ÁË£¡
function currencyFormatter(oNum,decimalSeparator,groupingNumber,groupingSeparator){
//check type
if(isNaN(parseFloat(oNum))){
alert(oNum + 'is not a number!');
return "";
}
//get sign and make oNum to abstract
var sign = (oNum == (oNum = Math.abs(oNum)));
//get fraction
var nDecimalString = oNum + '';
var nIndex = nDecimalString.indexOf('.');
var sFraction = '';
if(nIndex != -1){
sFraction = nDecimalString.substr(nIndex);
}
//get integer
var nInteger = parseInt(Math.floor(oNum));
var nInegerString = nInteger + '';
//insert separator
var aResult = [];
//method 1
/*
var length = nInegerString.length;
for (var i=length; i > 0 ; i-=groupingNumber) {
var nextI = i - groupingNumber;
if(nextI <= 0){
break;
}
aResult.unshift(nInegerString.substring(nextI,i));
aResult.unshift(groupingSeparator);
};
if(nextI <= 0){
&
Ïà¹ØÎĵµ£º
JavaScriptÀï×Ö·û´®ÀàÐÍת»»³ÉÈÕÆÚÀàÐÍ£º
Èç¹û×Ö·û´®ÖÐÓпոñ»òÊÇÆäËû·Ö¸î·û·Ö¸î£¬¿ÉÒÔÓÃsplit·½·¨ÏȲð·Ö£¬·µ»ØÒ»¸öÊý×飬ÔÙ°ÑÕâ¸öÊý×éÀïµÄÄêÔÂÈÕ×÷Ϊ²ÎÊý´«µ½new Date()ÀïÉú³ÉÈÕÆÚÀàÐÍ£»
Èç¹ýûÓÐÌØÊâ·Ö¸ô·û£¬¿ÉÒÔÓÃsubstr£¨x£¬y£©·½·¨À´È¡×Ó×Ö·û´®À´Éú³ÉÈÕÆÚ£¬substr£¨x£¬y£©Àx±íʾȡ×Ö´®µÄ¿ªÊ¼Î»Öã¬y±íʾ×Ó´®µÄ³ ......
prototype ÊÇÔÚ IE 4 ¼°ÆäÒÔºó°æ±¾ÒýÈëµÄÒ»¸öÕë¶ÔÓÚijһÀàµÄ¶ÔÏóµÄ·½·¨£¬¶øÇÒÌØÊâµÄµØ·½±ãÔÚÓÚ£ºËüÊÇÒ»¸ö¸øÀàµÄ¶ÔÏóÌí¼Ó·½·¨µÄ·½·¨£¡ÕâÒ»µã¿ÉÄÜÌýÆðÀ´»áÓеãÂÒ£¬±ð¼±£¬ÏÂÃæÎÒ±ãͨ¹ýʵÀý¶ÔÕâÒ»ÌØÊâµÄ·½·¨×÷ÒÑϽ²½â£º
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇÒªÏÈÁ˽âÒ»ÏÂÀàµÄ¸ÅÄJavaScript ±¾ÉíÊÇÒ»ÖÖÃæÏò¶ÔÏóµÄÓïÑÔ£¬ËüËùÉæ¼°µÄÔªËظù¾ÝÆäÊôÐÔµ ......
1£© Ϊʲô¼ÓÔØjavascriptÎļþºÜÖØÒª£¿
javascriptÎļþÊDZȽÏÌØÊâµÄ£¬ÒòΪä¯ÀÀÆ÷¼ÓÔØjavascriptÊÇ´®Ðеġ£ÒÔΪ×ÅÔÚ¼ÓÔØJavascriptÎļþµÄʱºò£¬ÆäËûÒ»ÇÐ×ÊÔ´µÄÏÂÔØ°üÀ¨Ò³ÃæµÄÏÔʾ¶¼»á±»×èÈû¡£
2£© ÈçºÎÕýÈ·µÄ¼ÓÔØJavaScript£¿
a. ½«JavaScriptÎļþ·ÅÔÚÒ³ÃæµÄ×îºó
ÒòΪJavaScriptµÄ¼ÓÔØ»á×èÈûÒ³ÃæµÄÏÔʾ£¬ËùÒÔ½«JavaScrip ......
ΪÁËÑ¡ÔñÒ»¸öºÏÊʵĽű¾ÓïÑÔѧϰ£¬½ñÌì²éÁ˲»ÉÙÓйØPerl£¬Python£¬Ruby£¬JavascriptµÄ¶«Î÷£¬¿ÉÊÇ·¢ÏÖ¸÷´óÕóÓªµÄÈ˶¼ÔÚ´µÅõ×Ô¼ºÏ²»¶µÄÓïÑÔ£¬²»¹ý×îûÓÐÕùÒéµÄÓ¦¸ÃÊÇJavascriptÏֽ׶λ¹²»ÊʺÏÓÃÀ´×ö¶ÀÁ¢¿ª·¢£¬ËüµÄÌìÏ»¹ÊÇÔÚwebÓ¦ÓÃÉÏ¡£ ÎÒÖ÷ÒªÊÇÏë×öÊý¾ÝÍÚ¾òËã·¨µÄÑо¿£¬Ó¦¸Ã»á´¦Àí´óÁ¿µÄÎı¾¡£Ìáµ½Îı¾´¦Àí£¬ÏàÐŴ󲿷ÖÈË ......
JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«
1£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”JavaScript”>
2: ......