![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
大猫先生
这个作者很懒,什么都没留下…
展开
-
各种语言取整
1.丢弃小数部分,保留整数部分 php: intval(7/2) js:parseInt(7/2) 2.向上取整,有小数就整数部分加1 php: ceil(7/2) js: Math.ceil(7/2) 3,四舍五入. php: round(7/2) js: Math.round(7/2) 4,向下取整 php: floor(7/2) js: Math.floor(7/2)原创 2015-06-04 18:05:38 · 301 阅读 · 0 评论 -
js创建对象继承
//字面量构造有用的对象 var myMammal={ name:'Herb the Mammal', get_name:function(){ return this.name; }, says:function(){ return this.saying || ''; } }; //封装的new方法 Object.beget = function (o)转载 2015-10-09 10:36:40 · 355 阅读 · 0 评论 -
js获取高度
document.documentElement.clientHeight 获取文档窗口可见高度原创 2015-10-10 15:16:16 · 313 阅读 · 0 评论