The lattice structure, band structure, density of state and optical properties of pure ZnO, Al, Ni doped ZnO and Al-Ni codoped ZnO were calculated by first-principles method respectively. The results reveal that the imaginary part of the dielectric function of pure ZnO and Al-ZnO, Ni-ZnO, (Al,Ni)-ZnO have an obvious difference in the low energy range, but are similar in the high energy range. As to the optical properties, the absorption coefficient and reflectivity of Al-ZnO are much smaller than Ni-ZnO, which means a higher transmissivity in the visible light range. Especially, compared with Al, Ni doped ZnO, (Al,Ni)-ZnO has a significant change in the optical properties.