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 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
自动刷新页面的方法:
1、自动刷新:
<script type="text/javascript">setInt ......
本来准备开讲jQuery源码学习笔记六的,但心中有佛才能看到佛,有些人连选择器都不知什么东西,直接讲下去,估计有人会看得云里雾里,满头雾水了。加之,John Resig有一种把代码写得不知所云的魔力,他拥有强大的驭驾代码的实力,他自己看当然没问题,其他人则要命了。常常是一句代码调用几个方法,每个方法相隔几十行甚至上 ......
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语法集锦是对javascript常用函数的一些小结,比较实用,建议收藏,方便查找需要的资料。
click() 对象.click() 使对象被点击。
closed 对象.closed 对象窗口是否已关闭true/false
clearTimeout(对象) 清除已设置的setTimeout对象
clearInterval(对象) 清除已设置的setInterval对象&n ......
一个非常实用的javascript读写Cookie函数
function GetCookieVal(offset)
//获得Cookie解码后的值
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie(name, v ......