码迷,mamicode.com
首页 > Web开发 > 详细

Jquery

时间:2018-01-02 21:17:41      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:csharp   指定   -o   span   views   name   tofixed   gpo   for   

1. 字符串格式化

var hot_li_template = ‘<li><div class="li-out"><span class="last"><i>{0}</i></span><span class="name"><a  href="{1}">{2}</a></span><span class="nums">{3}</span></div></li>‘

jQuery.format(hot_li_template, i + 1, url, data.title, numberScale(data.views));

 

ƒ (num) {
    var ret = num;

    if (num > 1000) {
        ret = (num / 1000).toFixed(1) + k;
    }
    return ret;
}

toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。

Jquery

标签:csharp   指定   -o   span   views   name   tofixed   gpo   for   

原文地址:https://www.cnblogs.com/yangfei-beijing/p/8178919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!