摘要: 1.获取字符串的长度: var s = "Hello world"; document.write("length:"+s.length); 2.为字符串添加各种样式 var txt = "Some words"; document.write("<p>Big: " + txt.big() + "< 阅读全文
posted @ 2017-09-10 00:25 Gaho 阅读(232) 评论(0) 推荐(0) 编辑
摘要: null 没有任何的属性值,并且无法获取其实体(existence)值。所以 null.property 返回的是错误(error)而不是 undefined 。 考虑下面的代码 if (node.nextSibling.className == ...) { ... } 在 node 或者 nod 阅读全文
posted @ 2017-09-10 00:20 Gaho 阅读(124) 评论(0) 推荐(0) 编辑
摘要: <script type="text/javascript"> /******************************************************************* 利用运算符优先级实现ifelse表达式 result = expression1 && expre 阅读全文
posted @ 2017-09-10 00:18 Gaho 阅读(419) 评论(0) 推荐(0) 编辑
摘要: 准备两个对象用于下面的讨论 var alice = { name: "alice", toString: function () { return this.name; } } var smith = { name: "smith", toString: function () { return t 阅读全文
posted @ 2017-09-10 00:16 Gaho 阅读(274) 评论(0) 推荐(0) 编辑