Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:
其他好文 时间:
2014-08-17 19:49:42
阅读次数:
190
15.2.4 事件冒泡 当浏览者在页面上执行某个动作时,页面上实际有多个元素可以响应该事件,假如单击页面的某个按钮,而该按钮又处于元素之内,则实际 上用户既单击了该按钮,也单击了该元素。 代码示范: //脚本代码 var gotClick = function...
分类:
其他好文 时间:
2014-08-17 19:46:02
阅读次数:
172
HTML代码: 修改我吧,然后刷新页面看看,^_^JS代码:var edit = document.getElementById("edit");edit.onblur = function(){ localStorage.setItem("tododata", this.innerHT...
分类:
Web程序 时间:
2014-08-17 19:45:12
阅读次数:
191
//组合构造函数+原型模式function Box(name,age){ //保持独立的用构造函数 this.name = name; this.age = age; this.family = ['哥哥','姐姐','妹妹']};Box.prototype ...
分类:
其他好文 时间:
2014-08-17 18:18:02
阅读次数:
175
//动态原型模式function Box(name,age){ this.name = name; this.age = age; this.family = ['哥哥','姐姐','妹妹']; if(typeof this.run != 'function'){ ...
分类:
其他好文 时间:
2014-08-17 18:17:42
阅读次数:
176
jQuery.parseHTML
给定一段HTML代码, 如何将其转化为DOM树以便处理?
如果使用jQuery, 可以使用其$.parseHTML 方法将HTML代码转化为DOM树.
var markup = '' +
'' +
'' +
'document.onclick=function(){console.log("clic...
分类:
Web程序 时间:
2014-08-17 17:07:52
阅读次数:
286
确认是否删除
function confirmd() {
var msg = "您真的确定要删除吗?/n/n请确认!";
if (confirm(msg)==true){
return true;
}else{
return...
分类:
Web程序 时间:
2014-08-17 15:39:32
阅读次数:
199
//原型创建对象function Box(){};Box.prototype.name = 'Lee';Box.prototype.age = 100;Box.prototype.run = function(){ return this.name + this.age + 'running....
分类:
其他好文 时间:
2014-08-17 15:30:22
阅读次数:
179
//构造函数创建对象function Box(name,age){ //创建一个对象 this.name = name; //添加一个属性 this.age = age; this.run = function(){ return this...
分类:
其他好文 时间:
2014-08-17 15:25:42
阅读次数:
137
熟悉web开发的程序员想必对Ajax也不会陌生。现在已经有很多js框架封装了ajax实现,例如JQuery的ajax函数,调用起来非常方便。当然本文不打算讲框架的使用,我们将从Ajax的javascript源码实现开始。Ajax源码实现var getXmlHttpRequest = function...
分类:
其他好文 时间:
2014-08-17 14:20:42
阅读次数:
209