Let (∑, g) be a compact Riemannian surface without boundary and λ1(∑) be the first eigenvalue of the Laplace-Beltrami operator △g. Let h be a positive smooth function on ∑. Define a functional (Jα,β(u)=1/2∫∑(| gu|2)dvg-βlog∫heudvg)on a function spaceH={u∈W1,2(∈):∫∑UDVG=0}.Ifα〈λ1(∑)and Jα,8π has no minimizer on H, then we calculate the infimum of Jα,8π on H by using the method of blow-up analysis. As a consequence, we give a sufficient condition under which a Kazdan-Warner equation has a solution. If α≥ λ1(E), then infu∈Hα,8π(u)=-∞.Ifβ〉8π ,then for any α ∈ R, there holds infu∈HJα,8π(u)=-∞. Moreover, we consider the same problem in the case that α is large, where higher order eigenvalues are involved.