Created
May 15, 2013 10:12
-
-
Save hrkd/5582948 to your computer and use it in GitHub Desktop.
ちょっとずつ育てる。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Object.prototype.getId = function(id){ | |
| return document.getElementById(id); | |
| }; | |
| Object.prototype.getTag = function(tag){ | |
| return document.getElementsByTagName(tag); | |
| }; | |
| Object.prototype.addChild=function(tag){ | |
| this.appendChild(document.createElement(tag)); | |
| return this.childNodes; | |
| }; | |
| Object.prototype.addEvent=function(type,func){ | |
| var tmpFnc = func; | |
| eval("var "+type.split(".")[1]+"=tmpFnc"); | |
| this.addEventListener(type.split(".")[0], eval(type.split(".")[1]), false); | |
| }; | |
| Object.prototype.removeEvent=function(type){ | |
| this.removeEventListener(type.split(".")[0], eval("this."+type.split(".")[1]), false); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment