Both undesirable walking environment and external perturbations will cause the ZMP (zero moment point) error and affect the walking stability of the humanoid robot. Since ZMP is affected by angles of all robot joints, it is difficult to achieve good walking-control performance if only correcting the ankle or hip angles of the support leg. Therefore, considering the influence of all joint angles on ZMP, the way to calculate the CoM (center of mass) position displacement of robot is studied by fuzzy controller based on ZMP error. Then angle corrections of all joints to match the CoM position displacement are computed by using quadratic programming and CoM Jacobian matrix. The simulation results show that by this method, the desired ZMP trajectory can be tracked very well, and the walking stability margin is improved, which helps the humanoid robot walk stably.