Examples are as follows:
<script> //Function: Repeated code block //There is only one object in the world to prevent global variables from contaminating var itcast = { getElen : { tag : function(tag){ return document.getElementsByTagName(tag); }, id : function(id){ return document.getElementById(id); } }, css : { addStyle : function(){}, removeStyle : function(){}, addClass : function(){} } } //Call itcast.getElen.tag('body')[0]; </script>The above simple example of packaging and obtaining dom elements is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.