Dynamic Channel Allocation is an important part of the Radio Resource Management in CDMA/CDD systems. In this paper we propose a new algorithm for code and time-slot allocation method when a new user applies for resources. The new algorithm consists of 2-dimensional searching. A set of candidate slots is first selected from the available slots. Then the spreading code with smallest spreading factor in the candidate slots is selected and assigned to the new user. By the scheme, the algorithm jointly optimizes the allocation of code and time slot.