为你而来

2012年6月4日

javascript:apply函数在面向对象中的用法

摘要: 1 <html> 2 <head> 3 <title>1</title> 4 </head> 5 <body> 6 <script language='javascript'> 7 function Point(x,y){ 8 this.x=x; 9 this.y=y;10 this.fun1=function(){11 return this.x+'/'+this.y;12 }13 }14 Point.prototype.valueOf=function(){15 ... 阅读全文

posted @ 2012-06-04 12:30 为你而来 阅读(225) 评论(0) 推荐(0) 编辑

javascript:prototype对象的用法

摘要: 在类而不是变量中,为类定义的名称添加方法。 1 <html> 2 <head> 3 <title>1</title> 4 </head> 5 <body> 6 <script language='javascript'> 7 function Me(){} 8 Me.prototype.fun=function(x){ 9 return x;10 }11 Me.prototype.sun=function(){12 document.write("<font color=' 阅读全文

posted @ 2012-06-04 12:01 为你而来 阅读(110) 评论(0) 推荐(0) 编辑

javascript:event对象

摘要: event.cancelBubble可以阻止事件冒泡 1 <html> 2 <head> 3 <style type='text/css'> 4 div{ 5 border:dashed 1px green; 6 width:200px; 7 height:100px; 8 } 9 </style>10 </head>11 <body id='mybody'>12 <div id='divone'>13 <button id='clickme' 阅读全文

posted @ 2012-06-04 08:58 为你而来 阅读(175) 评论(0) 推荐(0) 编辑

2012年6月3日

javascript事件

摘要: onchange,用户改变域的内容,所以存在type='text' select textarea中 要等失去焦点时onchange事件,和下拉列表<select>是有关系的,当其值因选定又改变时产生onchange事件1 <html>2 <head>3 </head>4 <body>5 <input type='text' onchange='alert(this.value);'/>6 7 </body>8 </html>注意和onkeydown比 阅读全文

posted @ 2012-06-03 22:25 为你而来 阅读(162) 评论(0) 推荐(0) 编辑

javascript事件冒泡

摘要: 1 <html> 2 <head> 3 <style type='text/css'> 4 div{ 5 border:dashed 1px green; 6 width:200px; 7 height:100px; 8 } 9 </style>10 </head>11 <body id='mybody'>12 <div id='divone'>13 <button id='clickme'>clickme</button> 阅读全文

posted @ 2012-06-03 21:19 为你而来 阅读(145) 评论(0) 推荐(0) 编辑

2012年6月2日

javascript函数闭包

摘要: 闭包也就是让一个函数返回值是一个函数,而返回的这个函数里边,有该函数内的变量,它不会随着包含它的函数消失而消失,而是被保留了下来。有两点需要注意,其一这个变量的值会递增,好似对象的方法在引用当中的对象属性 1 function f(){ 2 var x=12; 3 return function(){ 4 x+=5; 5 return x; 6 }; 7 } 8 var a=f(); 9 10 alert(a()+':'+a());11 12 //显示17:22其次,... 阅读全文

posted @ 2012-06-02 21:01 为你而来 阅读(188) 评论(0) 推荐(0) 编辑

2012年6月1日

javascript变量类型转换(简单记几个)

摘要: 1 Number()2 3 String()4 5 Boolean()6 7 //Boolean不能写作boolean 阅读全文

posted @ 2012-06-01 17:50 为你而来 阅读(108) 评论(0) 推荐(0) 编辑

MyEclipse8.5/8.0 终极优化(转载)

摘要: 现在许多新插件都要eclipse3.5以上,所以工具升级到了8.5,但是实在是太庞大了,在网上搜了搜,觉得这篇不错,就转来了。还在为自己的配置低而抛弃MyEclipse8.5/8.0..还在为那低下的速度而苦恼吧??那么.来试试优化的效果吧>然我我们来开始优化吧:1、老是弹出Quick update error 、关闭myeclipse的Quick Update自动更新功能这个问题的解决办法是关闭自动更新Windows > Preferences > MyEclipse Enterprise Workbench > Community Essentials,把选项”Se 阅读全文

posted @ 2012-06-01 00:00 为你而来 阅读(6348) 评论(0) 推荐(0) 编辑

2012年5月31日

javascript:call和apply函数的用法(转载)

摘要: JavaScript中有一个call和apply方法,其作用基本相同,但也有略微的区别。先来看看JS手册中对call的解释:call 方法调用一个对象的一个方法,以另一个对象替换当前对象。call([thisObj[,arg1[, arg2[, [,.argN]]]]])参数thisObj可选项。将被用作当前对象的对象。arg1, arg2,, argN可选项。将被传递方法参数序列。说明call 方法可以用来代替另一个对象调用一个方法。call 方法可将一个函数的对象上下文从初始的上下文改变为由 thisObj 指定的新对象。如果没有提供 thisObj 参数,那么 Global 对象被用作 阅读全文

posted @ 2012-05-31 20:51 为你而来 阅读(227) 评论(0) 推荐(0) 编辑

2012年5月30日

javascript杂记1

摘要: 1 var n=1;2 3 var f=new Function("return n;");4 5 new Function("x,y","return x+y;");//用new Function定义的函数为顶级函数,能够获取顶级的变量,如n1 ( function(a,b)2 {3 alert(typeof a+"\n"+typeof b);4 }5 )('a',1);1 func=new Function("this.a='struts';");2 3 fu 阅读全文

posted @ 2012-05-30 21:52 为你而来 阅读(210) 评论(0) 推荐(0) 编辑

导航