Javascript继承之对象冒充法
例如:有三个类classX,classY,classZ
classZ分别继承classX和classY
于是就有下面的写法:
function ClassZ(){
this.newMethod=classX;
this.newMethod();
delete this.newMethod;
this.newMethod=classY;
this.newMethod();
delete this.newMethod;
}
这种写法存在一个弊端.。如果classX和classY有具有同名的属性或方法。classy具有高优先级。
相关文档:
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="re ......
1.document.formName.item("itemName") 问题
说明:IE下,可以使用document.formName.item("itemName")或 document.formName.elements["elementName"];Firefox下,只能使用 document.formName.elements["elementName"].
解决方法:统一使用document.formName.elements["elementName"].
2.集合类对象问题
说明:IE下,可 ......
本文参考自:http://www.cnblogs.com/mophee/archive/2009/03/15/1412590.html
看到一博客里探讨javascript 里作用域的问题
例子1:
var tt = 'aa';
function test(){
alert(tt);
var tt = 'dd';
alert(tt);
}
test();
例子2:
var tt = 'aa';
funct ......
alert(parseInt("101101", 2))
运行代码
function toBin(intNum) {
var answer = "";
if(/\d+/.test(intNum)) {
while(intNum != 0) {
answer = Math.abs(intNum%2)+answer;
intNum = parseInt(intNum/2);
}
......
JavaScript 是 Web 开发与设计中不可或缺的东西,不管是一个简单的网页还是一个专业的站点,也不管你是高手还是菜鸟,如今 JavaScript
库越来越强大,可以胜任许多复杂的工作,然而同时,人们在众多 JavaScript 库面前又觉得无所适从,本文,我们将使用 Google 搜索出排名前 10 位的
JavaScript 库,并对它们逐一 ......