js
weixin_46176142
这个作者很懒,什么都没留下…
展开
-
用js实现图片轮播
项目收获 封装getElementById(),使用更方便。 Function (id){ Return typeof(id)===”string”?Document.getElementById(id):id; } getElementsByClassName IE8以下版本不支持 图片与圆点的联动通过index,和一个方法来实现 自定义属性 item[i].setAttribute(“data-index”,i); dix=this.getAttribute(“data-index”); 步骤 1.封原创 2020-07-06 13:19:56 · 227 阅读 · 0 评论 -
用js写计算器代码
此项目的收获 input[type=“text”]{}的css用法 isNaN(n):不能转换为数字:ture,可以转换成数字:flase return !isNaN(n); n=n.substr(0,n.length-1); 字符串减少最后一个 [0,NaN,“”,null,undefined]都可以直接转化为false,但这几个值不是完全相等的 return (n==“0”||n.length==0);判断里面是否正确,正确为true,错误为false; NaN 属性是代表非数字值的特殊值。该属性.原创 2020-07-05 17:37:09 · 5404 阅读 · 1 评论