The band structure, density of states, optical absorption properties and dielectric function of ZnO doped with Fe or Ni and co-doped with Fe and Ni have been investigated by using density functional theory. The calculated results show that the density of states near Fermi level is derived from Fe 3d and Ni 3d states. A new peak appears at 0.46eV in the imaginary part of dielectric function of doped ZnO. Moreover, the optical absorption spectrum shows an obvious red shift, and a strong peak is observed at 1.3eV after doping. The above results were qualitatively discussed in combination with the experimental and calculated results reported in the literature.