随笔分类 - javascript
javascript
摘要:方法一:str.charAt(str.length - 1)方法二:str.subStr(str.length-1,1)方法三: var str = "123456"; spstr = str.split(""); spstr[spstr.length-1];
阅读全文
摘要:目前我们常用的浏览器有Microsoft Internet Explorer 和 Firefox。我们已经不能使用以前区分IE与Netscape的方法来区分这二者。他们都没有document.layers对象,Firefox也没有document.all对象。但是Firefox能够正确的解释<layer>标签。那么我们就可以通过以下方法来鉴别浏览器的类型。<script lang...
阅读全文
摘要:网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWidth (包括边线的宽) 网页可见区域高:document.body.offsetHeight (包括边线的宽) 网页正文全文宽:document.body.scrollWidth 网页正文全文高:do...
阅读全文
摘要:为语句设定默认对象。 with (object) statements 参数 object 新的默认对象。 statements 一个或多个语句,object 是该语句的默认对象。 说明 with 语句通常用来缩短特定情形下必须写的代码量。在下面的例子中,请注意 Math 的重复使用: x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10) y =...
阅读全文
摘要:this 对象 返回“当前”对象。在不同的地方,this 代表不同的对象。如果在 JavaScript 的“主程序”中(不在任何 function 中,不在任何事件处理程序中)使用 this,它就代表 window 对象;如果在事件处理程序中使用 this,它就代表发生事件的对象。 一个常用的 this 用法: Code highlighting produced by Actipro Co...
阅读全文
摘要:JavaScript 控制 margin-top ,margin-left , margin-right ... 千万不要用这样做 document.getElementById("div1").style.margin-top="30px"; //这样是不对的 document.getElementById("div1").style.margintop="30px"; //这样是不对的 这个也...
阅读全文
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
阅读全文
摘要:请注意看TITLE变化 code: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
阅读全文
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->menu.className=i==cursel?"curr":""; con.style.display=i==cursel?"block":"none"; 是一个三元运算符 上面的写法也就是以...
阅读全文

浙公网安备 33010602011771号