摘要: 先用一个简单的例子说明:var o={flag:true}; var test=!!o.flag;//等效于var test=o.flag||false; alert(test);由于对null与undefined用!操作符时都会产生true的结果,所以用两个感叹号的作用就在于,如果明确设置了o中flag的值(非 null/undefined/0""/等值),自然test就会取跟o.flag一样的值;如果没有设置,test就会默认为false,而不是 null或undefined。在jQuery中比较经典的例子如下:(jQuery 1.7.0.js: Line 748)gr 阅读全文
posted @ 2012-01-15 11:34 polymorphic 阅读(473) 评论(0) 推荐(0) 编辑
摘要: Javascript刷新页面的几种方法:1 history.go(0) 2 location.reload() 3 location=location 4 location.assign(location) 5 document.execCommand('Refresh') 6 window.navigate(location) 7 location.replace(location) 8 document.URL=location.href自动刷新页面的方法:1.页面自动刷新:把如下代码加入<head>区域中<meta http-equiv="re 阅读全文
posted @ 2012-01-15 11:23 polymorphic 阅读(513) 评论(0) 推荐(0) 编辑