随笔分类 - javascript
摘要:<html><head><scripttype="text/javascript">functionsleep(n){varstart=newDate().getTime();while(true)if(newDate().getTime()-start>n)break;}functionhandleClick(abc){vardiv;div=document.createElement("span");div.innerHTML=abc+"";document.body.appendChil
阅读全文
摘要:<html><head><scripttype="text/javascript">functionhandleClick(abc){vardiv=document.createElement("div");div.innerHTML=abc;document.body.appendChild(div);}functionprocessArray(items,process,callback){vartodo=items.concat();//克隆数组setTimeout(function(){varitem=todo
阅读全文
摘要:客户端设置cookieSetCookie('Lan','chs')服务器端获取cookiecontext.Request.Cookies.Get("Lan").Value;
阅读全文
摘要:<html><head> <script type="text/javascript"> function playflash(url) { var ls_html; ls_html="<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#...
阅读全文
摘要:2*/ 3var p=new Employee('mxh',20); Code Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 1function Person(name) 2{ 3 this.name=name 4} 5...
阅读全文
摘要:1、new做的事情a、创建一个Object对象【O】。b、将new后面的function对象的【自身属性】和【prototype的属性】 赋值给【O】 2、js中的访问“对象的属性”例如a.b是有先后顺序的,即先访问【自身的属性】,然后访问【prototype的属性】。
阅读全文
摘要://typeof 并不能取出详细的类型(例如:a和b取出的都是Object),但用变量的constructor可以取出具体的类型 a= { e:'a' } //a.constructor==Object var b=new Array("a","b");//b.constructor==Array var c="sss";//c.constructor==String d=...
阅读全文
摘要:/* //:冒号的用法表示类的属性或者方法(与c#比较) //{}新建对象 //var aa={a:{b}};//表示新建对象,并且设置对象的属性的值 //var aa={a:1}; //alert(aa.a); alert(_.get({a:{b:{c:1}}},['a','b','c'])); */ /* //测试hash //.has['a']['b']==>...
阅读全文
摘要://-------------------------------- //短信系统 //-------------------------------- ShortObj=function() { //this.url="http://192.168.0.118";//短信系统的url this.url="http://10.11.117.163";//短信系统的url } Short...
阅读全文
摘要://javaScript中类的定义 Class1=func()//类的定义 { this.name='';//类的私有变量 } Class1.prototype.Method1=func()//类class共有方法 { var a='';//方法Method1的私有变量 } //C#中类的定义 public class Class1 { private string nam...
阅读全文
摘要:function classA() { this.first='1'; this.cs=function() { alert('cs'); } } //3,4,5的区别 //3,4是在类不实例化就存在此原型方法 //5是在类实例化后才有此原型方法 classA.prototype.a = function(){return "a";};//3 classA.prototype.b...
阅读全文
摘要://private,public,static,construct的理解 function class1() { //private fields var m_first=1; var m_second=2; m_third=3;//全局变量 //private method var method1=function() { alert(m_first); } v...
阅读全文
摘要:function ClassA(sColor)//基类 { this.color=sColor;//用构造函数定义类的属性 } ClassA.prototype.sayColor=function()//用原型对象定义类的方法 { alert(this.color); } function ClassB(sColor)//子类 { ClassA.call(this,sColor);//用...
阅读全文
摘要://构造函数\原型方法混合法定义类 function Car()//定义类 { var color='red';//私有只能在构造函数中使用 this.color=color;//公有对象属性 } Car.prototype.run=function()//定义公有方法 { alert(this.color); }
阅读全文
摘要://-------------------------------------//mxh--20070612//日历控件//使用方法ShowCalendar(InputBox,template)//参数说明:inputBox:显示的文本框// template:显示格式"yyyy-mm-dd hh:ii:ss"中间的字母不变可以任意调整其他的字符,包括添加例如:yyyy年mm月dd日hh时ii...
阅读全文

浙公网安备 33010602011771号