The hybrid space of robots is divided into task space and joint space, with task space focused on trajectory-tracking accuracy, while joint space considers dynamic responsiveness and synchronization. Therefore, the robot-motion control systems need to effectively integrate both aspects, ensuring precision in task trajectory while promptly responding to unforeseen environmental events. Hence, this paper proposes an online trajectory-generation method for robots in both joint and task spaces. In task space, a planning approach is presented for high-precision NURBS curves. The global NURBS curve is segmented into several rational Bezier curves, establishing local coordinate systems for control points. This ensures that all local control points meet the chord error constraint, guaranteeing trajectory accuracy. To address the feed rate dynamic planning issue for segmented curves, an improved online S-shape feed-rate scheduling framework is introduced. This framework dynamically adjusts the current execution speed to meet task requirements. In joint space, an offline velocity planning based on a time synchronization scheme and a multi-dimensional synchronization technique based on the principle of spatial-coordinate system projection are proposed. Building upon the offline scheme, it allows for the modification of the target state for any sub-dimension during the motion process, with the remaining dimensions adapting accordingly. Simulation and experimentation demonstrate that the two proposed online trajectory generations for robot motion spaces, while ensuring task trajectory accuracy, effectively handle external unexpected events. They ensure joint synchronization and smoothness, carrying significant practical implications and application value for the stability of robot systems.