• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
JS小灰童鞋
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年1月29日
判断数据类型
摘要: Object.prototype.toString.call([]); Object.prototype.toString.call({}); // toLowerCase() 转化成小写 与 typeof 返回值同步 阅读全文
posted @ 2016-01-29 15:50 JS小灰童鞋 阅读(120) 评论(0) 推荐(0)
ECMAScript数据类型
摘要: 【 基本数据类型 】-->5种 Undefined Null Boolean Number String 【 复杂数据类型 】-->1种 Object 【 typeof 返回值】 -->6种 "undefined" "boolean" "string" "number" "object" "func 阅读全文
posted @ 2016-01-29 15:34 JS小灰童鞋 阅读(168) 评论(0) 推荐(0)
小结1
摘要: <script> var name = "jack"; age = "18"; //console.log(name,age); //不报错 但不推荐 function test(){ gender = "man"; //全局变量 但必须调用一次该函数 } test(); console.log(g 阅读全文
posted @ 2016-01-29 15:25 JS小灰童鞋 阅读(105) 评论(0) 推荐(0)
生成有序的随机数
摘要: <script> function randomNumber(n, start, end) { var i = 0, arr = []; for (; arr.length < n; i++) { var num = Math.floor(Math.random() * (end - start)) 阅读全文
posted @ 2016-01-29 13:10 JS小灰童鞋 阅读(567) 评论(0) 推荐(0)
原生的on事件代理
摘要: <script> // jQuery $('.el').on('event', function() { }); // 原生方法 [].forEach.call(document.querySelectorAll('.el'), function(el) { el.addEventListener( 阅读全文
posted @ 2016-01-29 11:28 JS小灰童鞋 阅读(320) 评论(0) 推荐(0)
原生的切换类
摘要: <script> $('.el').addClass('class'); $('.el').removeClass('class'); $('.el').toggleClass('class'); // 原生方法 document.querySelector('.el').classList.add 阅读全文
posted @ 2016-01-29 11:25 JS小灰童鞋 阅读(200) 评论(0) 推荐(0)
图片验证码及自动刷新
摘要: <script> function imgCode() { $("#imgCode").on("click", function() { $(this).attr("src", '/user/verify?t=' + Math.random()); }); }; /* 当后台返回验证码错误时,绑定t 阅读全文
posted @ 2016-01-29 11:11 JS小灰童鞋 阅读(1197) 评论(0) 推荐(0)
地址跳转
摘要: var _HOSTNAME_ = [window.location.protocol, '//', window.location.hostname, '/'].join(''); if (/^http/.test(data.data.url)) { window.location.href = d 阅读全文
posted @ 2016-01-29 11:04 JS小灰童鞋 阅读(127) 评论(0) 推荐(0)
验证码倒计时
摘要: <body> <span id="sendCode" style="background: #ccc;padding: 5px;">发送验证码</span> <script src="http://code.jquery.com/jquery-1.12.0.min.js"></script> <sc 阅读全文
posted @ 2016-01-29 10:58 JS小灰童鞋 阅读(162) 评论(0) 推荐(0)
倒计时
摘要: <script> function timerOver(year, month, day) { window.setInterval(function() { var now = new Date(), endDate = new Date(year, month - 1, day), leftTi 阅读全文
posted @ 2016-01-29 10:35 JS小灰童鞋 阅读(146) 评论(0) 推荐(0)
判断浏览器内核
摘要: <script> var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; return { //移动终端浏览器版本信息 trident: u.indexOf('Tr 阅读全文
posted @ 2016-01-29 10:27 JS小灰童鞋 阅读(169) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3