摘要: var i = 100;var x= i++ + i++ + i++ * --i;//x=? 答案是100 + 101 + 102 * 102 var i = 100;var x = i++ + i++ + i++ * (--i,--i,--i) = ?//x=? //答案是:100+101+102*(102,101,100)结论:自增运算在表达式中的运算法则是,先由左向右确定各子表达式值,再计算,无视运算顺序(注意上面有乘法和逗号表达式) 阅读全文
posted @ 2011-11-08 00:45 Arliang 阅读(213) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html><html><head> <title>对称日计算</title> <meta http-equiv="Content-Type" content="text/html;charset=gb2312"> <script>function getSymmetricalDate(year) { y = '' + year; if (y.length != 4) return false; var y, m, shortM, d, 阅读全文
posted @ 2011-11-02 23:55 Arliang 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.body.offsetWidth (包括边线的宽)网页可见区域高: document.body.offsetHeight (包括边线的高)网页正文全文宽: document.body.scrollWidth网页正文全文高: document.body.scrollHeight网页被卷去的高: document.body.scrollTop网页被卷去的左: document.body.scrollLeft网页正文部分上: w 阅读全文
posted @ 2011-10-17 15:30 Arliang 阅读(197) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html><html><head> <title>厕所部门tree</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <script>function myObj(data) { var arr = data.split(/\n+/); for (var i = 0, len = arr.length; i < len; i++) { if (!a 阅读全文
posted @ 2011-10-14 15:09 Arliang 阅读(4773) 评论(0) 推荐(0) 编辑
摘要: function loadScript(url, callback) { var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function() { if (script.readyState == "loaded" || script.readyState == "complete") { 阅读全文
posted @ 2011-10-08 15:35 Arliang 阅读(292) 评论(0) 推荐(0) 编辑
摘要: window.getStyle = (document.body.currentStyle //这样做是为了让函数有“记性”,不用每次使用这函数的时候都判断一次 ? function (obj, attribute){ obj.currentStyle[attribute] } : document.defaultView ? function (obj, attribute){ return document.defaultView.getComputedStyle(obj,false)[attribute]; } : function (){ return null; }//IE下body 阅读全文
posted @ 2011-07-22 01:30 Arliang 阅读(926) 评论(0) 推荐(0) 编辑
摘要: 2011年7月15日23:34:18效率PK —— 统计字符串中字符出现次数原文见:javascript 统计哪个字符出现的次数最多–修正版var str = "The officials say tougher legislation is needed because some \telecommunications companies in recent years have begun new services and made \system upgrades that create technical obstacles to surveillance. They wan 阅读全文
posted @ 2011-07-16 19:13 Arliang 阅读(3054) 评论(3) 推荐(1) 编辑
摘要: replace的用法:string.replace(sourceText, replaceText) 先看看replace(RegExp, String) ——摘自《Windows 脚本技术.chm》::/html/js56jsmthreplace.htm 下面任意的匹配变量都能用来识别最新的匹配以 阅读全文
posted @ 2011-07-06 13:57 Arliang 阅读(9015) 评论(0) 推荐(1) 编辑
摘要: 在Windows7下,打开chm文件后,如果切换到“索引”标签,会出现程序崩溃的情况,还会生成一个与chm文件同名的chw文件。 阅读全文
posted @ 2011-06-16 22:56 Arliang 阅读(8278) 评论(1) 推荐(1) 编辑
摘要: 遇到status = 12031错误,搜到此文:在ie6 sp1访问https站点,ajax会随机出现一个winet的状态码:12152。如果你还没有看到过这个困惑的状态码,请参看这里。这至少可以说明两个问题 new ActiveXObject(progId)生成的XMLHttpRequest是winet的一部分。MS很喜欢资源重利用,从select这个怪胎就可以看出来了。MS ie7以下对ssl的支持不够好。纵然ajax带来很好的用户体验,给无数前端开发的人员提供了就业机会。但是我的意见还是坚持的是,在没有ajax的时候,我们的web页面也要能成功的运行。那么,从上面这样的bad case看 阅读全文
posted @ 2011-06-04 00:40 Arliang 阅读(654) 评论(0) 推荐(0) 编辑