The band structure, density of states, electron density difference and optical properties of ZnO co-doped with transition metal (Mn, Fe, Co, or Cu) and N have been investigated by using density functional theory based on first-principles ultrasoft pseudopotential method. The optical properties of co-doped ZnO are similar to those of ZnO doped only with transition metal (Mn, Fe, Co and Cu), but rather different from those of pure ZnO. Moreover, our calculation indicates that co-doping of transition metal (Mn, Fe, Co, and Cu) and N is in more favor of the formation of p-type ZnO.