随笔分类 -  代码笔记

记录代码点点滴滴
摘要:while循环计算 var i = 1; var sum = 0; while(i<=100){ sum = sum + i; i++; } console.log(sum); for循环计算 var i = 1; var sum = 0; for(;i<=100;i++){ sum = sum + 阅读全文
posted @ 2022-01-03 11:13 富瑞阿得 阅读(1042) 评论(0) 推荐(0) 编辑
摘要:使用Date()获取日期 getMonth()+1得到当前月份 var ndate = new Date(); var nmonth = ndate.getMonth()+1; 弹窗显示 alert("当前月份:"+nmonth+"月"); 控制台输出 console.log("当前月份:"+nmo 阅读全文
posted @ 2022-01-03 10:40 富瑞阿得 阅读(1673) 评论(0) 推荐(0) 编辑
摘要:两种方法在body元素中插入一个按钮 <input id='btn' type='button' value='按钮' /> 使用appendChild()方法插入 var inputbtn = document.createElement('input'); inputbtn.id="btn"; 阅读全文
posted @ 2022-01-03 10:20 富瑞阿得 阅读(2328) 评论(0) 推荐(0) 编辑
摘要:非火狐(Firefox)浏览器 document.onmousewheel = function(e) { var e = e || window.event; if (e.wheelDelta < 0) { //鼠标下滑事件 } if (e.wheelDelta > 0) { //鼠标上滑事件 } 阅读全文
posted @ 2022-01-02 16:09 富瑞阿得 阅读(416) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示