var g = function (id){ if ( id.substr(0,1) == "."){ return document.getElementsByClassName(id.substr(1)); } return document.getElementById(id);}
var g = function (id) 可以改成 function g(id) {...}