//獲取標簽方法 function $(TagName){ return typeof TagName==="string" ? document.getElementsByTagName(TagName):null; } //獲取id方法 function $(id){ return typeof id==="string" ? document.getElementById(id):null; } //獲取類選擇器方法 function $(class){ return typeof class==="string" ? document.getElementsByClassName(class):null; }