Javascript编程
笨笨兔兔兔兔兔
这个作者很懒,什么都没留下…
展开
-
无聊写了一个js的东西,关于按键的控制
调速ns4=(document.layers)?true:false;ie4=(document.all)?true:false;document.onkeydown=keydowndocument.onkeyup=keyupvar direct;var ekey;var directkey;function init(){ if(ns4) block=document.bloc原创 2004-12-31 16:10:00 · 2350 阅读 · 6 评论 -
如何利用javascript中的原型实现继承
常常说prototype,那javascript里prototype到底是什么呢?金山词霸一下就知道了,原型。msdn中关于prototype的解释是 返回对象类型原型的引用。这段话是非常tmd的抽象,太令人费解了。后来看过了javascript权威指南一书后,我大概理解了其中的道理。其中书中有这么一句,所有的对象都有一个prototype,它引用了对象。虽然原型对象初始化时是空的,但是你在其中定原创 2007-10-23 09:58:00 · 1991 阅读 · 0 评论 -
javascript中apply方法和call方法的作用以及prototype.js中的应用
call方法在msdn中的解释 调用一个对象的一个方法,以另一个对象替换当前对象。apply方法在msdn中的解释 应用某一对象的一个方法,用另一个对象替换当前对象。这个解释也是非常抽象的,这两个方法的作用基本是一样的,举个例子function cls1(){ this.a=123;}cls1.prototype.fun1=function(){ alert(this.a);}funct原创 2007-10-23 16:41:00 · 6823 阅读 · 6 评论 -
随手写的一个与外部容器等比例缩放的东西,送给个美女
div style="backgroud-color:#000000;padding-left:20px;width:300px;">img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" />div>input type="button" value="Bilblt" onclick="Bitblt()" />script>f原创 2007-06-03 00:14:00 · 2523 阅读 · 0 评论 -
关于合成模式的javascript的一个treeview例子
合成模式的意思是说用一个对象加载另外一个对象进来而形成的,非常适合树型结构,也很类似链表结构下面举一个我写的javascript的treeview做例子 var treebase = { rootnum : 0 }; function treeview(nodetxt,nodehref,nodetag){ this.childNodes=[]; this原创 2007-04-03 09:43:00 · 2691 阅读 · 0 评论 -
javascript写的图片转换
function controlimg(imgid){ this.objid=imgid; this.imgnum=0; this.imgarr=new Array(); }controlimg.prototype.add=addimg;controlimg.prototype.loadpic=preload;controlimg.prototype.convert=changeimg原创 2006-06-21 12:52:00 · 3388 阅读 · 6 评论 -
用js写的一个跑马灯
function cls_marquee(id,id1,id2,sp){ this.obj_id=id; this.obj_id1=id1; this.obj_id2=id2; this.speed=sp; eval(this.obj_id2+".innerHTML="+this.obj_id1+".innerHTML"); function Marq原创 2006-05-22 11:36:00 · 2340 阅读 · 1 评论 -
对firefox的xmlhttp的一点点小研究
因为工作的需要用了一下firefox的xmlhttp也就是XMLHttpRequest()的应用,发现跟ms很不相同主要是有三点要注意的第一个是var xmlHttpReq = new XMLHttpRequest(); xmlHttpReq.open("GET", "http://localhost/xml.asp", false); xmlHttpReq原创 2006-02-14 16:52:00 · 3087 阅读 · 2 评论 -
js做的日历
新建网页 8function calendar(month,year){ var today; var len = calendar.arguments.length; if(len == 2){ this.month = calendar.arguments[0]; this.year = calendar.arguments[1]; } else{ today = new原创 2005-01-26 08:17:00 · 2597 阅读 · 2 评论 -
vbscript以及javascript的事件委托方案
javascript版的:function delegate(){ this.event=new Array();}delegate.prototype.add=function(fun,obj){ this.event[this.event.length]=function(){ fun.apply(obj); };}delegate.prototype.exec=function原创 2008-01-01 17:58:00 · 2245 阅读 · 6 评论