In this paper, D-type iterative learning control schemes, which guarantee that the desired output is tracked precisely through iteration, are presented. Both off-line and on-line schemes are considered for a class of nonlinear systems. In both schemes, the learning gain may be time-varying and thus possesses larger scope for adjustment. Specifically, not only the input but also the initial state is iterated in the algorithms, and the output channel is fully nonlinear. Then, sufficient conditions are presented which guarantee the convergence of the proposed algorithms. The desired input and desired state are not assumed to be known a priori. Finally, the results are applied to a robotic system through simulation, which demonstrates the effectiveness of the method.