首页 > Web开发 > 详细

Jquery

时间:2018-01-02 20:37:35      阅读:203      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!