随笔分类 -  javascript

摘要:function areaword(value) { var wd = new ActiveXObject("Word.Application"); var doc = wd.Documents.Add("", 0, 1); var range = doc.Range(0, 1); var sel = document.body.createTextRange(); sel.moveToElementText(value); sel.select(); sel.execCommand("Copy"); range.Paste(); w 阅读全文
posted @ 2013-07-19 11:31 returnKing 阅读(277) 评论(0) 推荐(0)
摘要:在应用有frameset或者iframe的页面时,parent是父窗口,top是最顶级父窗口(有的窗口中套了好几层frameset或者iframe),self是当前窗口, opener是用open方法打开当前窗口的那个窗口。window.self功能:是对当前窗口自身的引用。它和window属性是等价的。语法:window.self注:window、self、window.self是等价的。window.top功能:返回顶层窗口,即浏览器窗口。语法:window.top注:如果窗口本身就是顶层窗口,top属性返回的是对自身的引用。window.parent功能:返回父窗口。语法:window. 阅读全文
posted @ 2013-07-12 11:30 returnKing 阅读(130) 评论(0) 推荐(0)
摘要:1.对象冒泡关键字this引用的是构造函数当前创建的对象,不过在这个方法中,this指向的是所属的对象把ClassA作为常规的函数来建立继承机制。 1 function ClassA(sColor) 2 { 3 this.color=sColor; 4 this.sayColor=function(){ 5 alert(this.color); 6 }; 7 } 8 9 10 11 function ClassB(sColor){12 this.newMethod=ClassA;13 ... 阅读全文
posted @ 2013-07-11 08:53 returnKing 阅读(165) 评论(0) 推荐(0)
摘要:js继承有5种实现方式:1、继承第一种方式:对象冒充 function Parent(username){ this.username = username; this.hello = function(){ alert(this.username); } } function Child(username,password){ //通过以下3行实现将Parent的属性和方法追加到Child中,从而实现继承 //第一步:this.method是作为一个临时的属性,并且指向Parent所指向的对象, //第二步:执行this.method方法,即执行Parent所指向的对象函数 //第三步... 阅读全文
posted @ 2013-07-10 14:23 returnKing 阅读(153) 评论(0) 推荐(0)