在"JavaScript进阶系列05,事件的执行时机, 使用addEventListener为元素同时注册多个事件,事件参数"中已经有了一个跨浏览器的事件处理机制。现在需要使用这个事件处理机制为页面元素注册事件方法。 □ 点击页面任何部分触发事件 创建一个script1.js文件。(function...
分类:
编程语言 时间:
2014-10-05 02:27:57
阅读次数:
288
Are you baffled(阻碍;使迷惑) by thenewoperator in JavaScript? Wonder what the difference between a function and a constructor is? Or what the heck a protot...
分类:
编程语言 时间:
2014-10-05 02:10:27
阅读次数:
326
Are you baffled(阻碍;使迷惑) by thenewoperator in JavaScript? Wonder what the difference between a function and a constructor is? Or what the heck a protot...
分类:
编程语言 时间:
2014-10-05 01:04:07
阅读次数:
390
1 Local static variablesLocal static variables are not destroyed when the function ends; they are destroyed when the program terminates.2. Function pa...
分类:
其他好文 时间:
2014-10-04 23:58:17
阅读次数:
259
getXY : function(element){ var y = element.offsetTop; var x = element.offsetLeft; while(element = element.offsetParent){ y += element.offsetTop; ...
分类:
其他好文 时间:
2014-10-04 22:48:07
阅读次数:
316
javascript 的join("")方法,把数组变成统一字符串,用来写长的参数字符串 function m(a) { var b = ["", "", e ? "": "", "", "", "", "", "", "", "", n(a), "", "", k(a), "", "&q
分类:
编程语言 时间:
2014-10-04 22:27:57
阅读次数:
243
function对象都是Function的实例:> Object.getOwnPropertyNames(Function)[ 'length', 'name', 'arguments', 'caller', 'prototype' ]所以function对象也应该有这些方法或者是属性:所以...
分类:
编程语言 时间:
2014-10-04 21:44:27
阅读次数:
240
使用类之前使用关键字type来声明一个类如type A = class i,j,k:integer; procedure setA(a,b,c:integer); function gerA():integer;end;这里已经定义了一个类,现在我们来使用类在使用类之前,我们先必须给下面2行...
分类:
其他好文 时间:
2014-10-04 21:02:47
阅读次数:
134
/**
* 将字符串转换为数组
*
* @param string $data 字符串
* @return array 返回数组格式,如果,data为空,则返回空数组
*/
function string2array($data) {
if($data == '') return array();
@eval("\$array = $data;");
...
分类:
其他好文 时间:
2014-10-04 20:40:27
阅读次数:
139
(翻译不当之处请谅解)
这里有5个小脚本,有助于你真正理解JavaScript核心–闭包和作用域。没有在控制台运行之前,尝试回答每个案例中会弹出什么内容,然后你可以创建一个测试文件去核对你的答案。你准备好了吗?
1、
1: if (!("a" in window)) {
2: var a = 1;
3: }
4: alert(a);
2、
1: var a = 1,
2: b = function a(x) {
3: ...
分类:
编程语言 时间:
2014-10-04 19:50:47
阅读次数:
185