Effective optical constants of Ag thin films are precisely determined with effective thickness simultaneously by using an ellipsometry iterated with transmittance method. Unlike the bulk optical constants in Palik's database the effective optical constants of ultrathin Ag films are found to strongly depend on the thickness. According to the optical data two branches of thickness dispersion of surface plasmon energy are derived and agreed with theoretical predication. The thickness dispersion of bulk plasmon is also observed. The influence of substrate on surface plasmon is verified for the first time by using ellipsometry. The thickness dependent effective energy loss function is thus obtained based on this optical method for Ag ultrathin films. This method is also applicable to other ultrathin films and can be used to establish an effective optical database for ultrathin films.