Home > Web Front-end > JS Tutorial > Javascript function packing is mostly used for event binding_js object-oriented

Javascript function packing is mostly used for event binding_js object-oriented

WBOY
Release: 2016-05-16 19:07:01
Original
1398 people have browsed it


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> function addShell(func,name,obj) { func=Function(func); if(!obj) obj=window; var old = obj[name]; if (typeof obj[name] != 'function') { obj[name] = func; } else { obj[name] = function() { var ja=[]; var t = obj[name].arguments; for(var x=0;x<t.length;x++) ja.push(t[x]); old.apply(null,ja); func.apply(null,ja); } } } //--测试代码开始-- addShell('alert(arguments[0]+":"+arguments[1]+":"+arguments[2])',"aaa"); addShell('alert(arguments[0]+":"+arguments[1]+":"+arguments[2])',"aaa"); addShell('alert(arguments[0]+":"+arguments[1]+":"+arguments[2])',"aaa"); addShell('alert(arguments[0]+":"+arguments[1]+":"+arguments[2])',"aaa"); addShell('alert(arguments[0]+":"+arguments[1]+":"+arguments[2])',"aaa"); addShell('aaa("1111","3333","5555")',"onload"); addShell('aaa("1","3","5")',"onload"); //--测试代码结束-- </script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template