JavaScript toFixed() ·½·¨
±¾ÎÄת×Ô£ºhttp://www.w3school.com.cn/js/jsref_tofixed.asp
¶¨ÒåºÍÓ÷¨
toFixed() ·½·¨¿É°Ñ Number ËÄÉáÎåÈëΪָ¶¨Ð¡ÊýλÊýµÄÊý×Ö¡£
Óï·¨
NumberObject.toFixed(num)
²ÎÊýnumÃèÊö±ØÐè¡£¹æ¶¨Ð¡ÊýµÄλÊý£¬ÊÇ 0 ~ 20 Ö®¼äµÄÖµ£¬°üÀ¨ 0 ºÍ 20£¬ÓÐЩʵÏÖ¿ÉÒÔÖ§³Ö¸ü´óµÄÊýÖµ·¶Î§¡£Èç¹ûÊ¡ÂÔÁ˸òÎÊý£¬½«Óà 0 ´úÌæ¡£
·µ»ØÖµ
·µ»Ø NumberObject µÄ×Ö·û´®±íʾ£¬²»²ÉÓÃÖ¸Êý¼ÆÊý·¨£¬Ð¡ÊýµãºóÓй̶¨µÄ num λÊý×Ö¡£Èç¹û±ØÒª£¬¸ÃÊý×ֻᱻÉáÈ룬Ҳ¿ÉÒÔÓà 0 ²¹×㣬ÒÔ±ãËü´ïµ½Ö¸¶¨µÄ³¤¶È¡£Èç¹û num ´óÓÚ le+21£¬Ôò¸Ã·½·¨Ö»µ÷Óà NumberObject.toString()£¬·µ»Ø²ÉÓÃÖ¸Êý¼ÆÊý·¨±íʾµÄ×Ö·û´®¡£
Å׳ö
µ± num ̫С»òÌ«´óʱÅ׳öÒì³£ RangeError¡£0 ~ 20 Ö®¼äµÄÖµ²»»áÒý·¢¸ÃÒì³£¡£ÓÐЩʵÏÖÖ§³Ö¸ü´ó·¶Î§»ò¸üС·¶Î§ÄÚµÄÖµ¡£
µ±µ÷Óø÷½·¨µÄ¶ÔÏó²»ÊÇ Number ʱÅ׳ö TypeError Òì³£¡£
ʵÀý
ÔÚ±¾ÀýÖУ¬ÎÒÃǽ«°ÑÊý×ÖÉáÈëΪ½öÓÐһλСÊýµÄÊý×Ö£º
Show the number 13.37 with one decimal:
<script type="text/javascript">
var num = new Number(13.37);
document.write (num.toFixed(1))
</script>
Êä³ö£º
Show the number 13.37 with one decimal:
13.4
Ïà¹ØÎĵµ£º
<script>
/*
ÓÃ;£ºÐ£ÑéipµØÖ·µÄ¸ñʽ
ÊäÈ룺strIP£ºipµØÖ·
·µ»Ø£ºÈç¹ûͨ¹ýÑéÖ¤·µ»Øtrue,·ñÔò·µ»Øfalse£»
*/
function isIP(strIP) {
if (isNull(strIP)) return false;
var re=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g //Æ¥ÅäIPµØÖ·µÄÕýÔò±í´ïʽ
if(re.test(strIP))
{
if( RegExp.$1 <256 &am ......
ÔÚ×öÍøÕ¾µÄʱºò£¬ÎÒÃǾ³£ÐèÒª¶Ô³ß´ç³¬±êµÄͼƬ½øÐÐËõ·Å¡£
ÓÉÓÚä¯ÀÀÆ÷µÄ²îÒ죬ÓÐЩ´úÂëijЩä¯ÀÀÆ÷¹¤×÷²»Õý³£¡£
¾¹ýÑо¿µÃµ½ÁËÒÔϵĴúÂ룬Ëü¿ÉÒÔÔÚIE6,IE8,FireFoxÖÐÍêÃÀµØ°´±ÈÀýËõ·ÅͼƬ¶ø²»Ê§Õæ¡£
//¸Ä±äͼƬ´óС
function resizepic(o)
{
var maxwidth=550; //¶¨Òå×î´ó¿í¶È
var maxheight=800;&nbs ......
<mce:script type="text/javascript"><!--
function SetCookie(name,value,expire) {
var exp = new Date();
exp.setTime(exp.getTime() + expire);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
} ......
function openCheck()
{
if (!this.external)
{
app.alert("Acrobat¤Ç¤Ï実ÐФǤ¤Þ¤»¤ó");
this.closeDoc(true);
// var myDoc = event.target;
// myDoc.closeDoc(true);
}
}
openCheck();
ÐèҪעÒâµÄÊÇ:
1. ÉÏÊöµÄsourceÖ»ÄÜÔÚPDF ÓÃAcrobat Reader´ò¿ªÊ±²ÅÆð×÷ÓÃ,
ÈçÓÃIEµÈ´ò¿ªÊ±»á±¨¡¸NotSu ......