Step 1: Using the onto function formula.
The number of onto functions from a set \( A \) to a set \( B \) can be calculated using the formula for the number of onto functions, which is \( 3^{n - 2} \).
Step 2: Conclusion.
Thus, the correct answer is option (D).