  A new method of measuring cosmology with gamma-ray bursts(GRBs) has been
proposed by Liang and Zhang recently. In this method, only observable
quantities including the rest frame peak energy of the \nu F_\nu spectrum
(E'_p), the isotropic energy of GRB (E_{\gamma,iso}), and the break time of the
optical afterglow light curves in the rest frame (t'_b) are used. By
considering this method we constrain the cosmological parameters and the
redshift at which the universe expanded from the deceleration to acceleration
phase. We add five recently-detected GRBs to the sample and derive E_{\gamma,
iso}/10^{52} ergs=(0.93\pm 0.25)\times (E'_p/100 keV)^{1.91\pm 0.32}\times
(t'_b/day)^{-0.93\pm 0.38} for a flat cosmology with \Omega_M=0.28 and H_0=71.0
km s^{-1} Mpc^{-1}. This relation is independent of the medium density around
bursts and the efficiency of conversion of the explosion energy to gamma-ray
energy that are difficult to measure. We regard the E_{\gamma,iso}(E'_p, t'_b)
relationship as a standard candle and find 0.05<\Omega_M<0.48 and
\Omega_\Lambda<1.15 (at the 1\sigma confidence level). In a flat universe with
the cosmological constant we obtain 0.25<\Omega_M <0.46 and
0.54<\Omega_\Lambda<0.78 at the 1\sigma confidence level. The transition
redshift is z_T=0.69_{-0.12}^{+0.11}. Combining 20 GRBs and 157 type Ia
supernovae, we find \Omega_M=0.29 \pm0.03 for a flat universe and the
transition redshift is z_T=0.61_{-0.05}^{+0.06}, which is slightly larger than
the value found by considering SNe Ia alone. In particular, We also discuss
several dark-energy models in which the equation of state w(z) is arameterized
and investigate constraints on the cosmological parameters in detail.
