Pete, assuming the voltage, current and plug type are all the same, there shouldn't be a problem. Watch out for some of the generic replacements, though, they tend to fall way short on the current. And a Compaq adapter with a higher current output than that won't hurt the machine.
OH!, almost forgot. If it's a "barrel" type plug, (a hollow tube, more or less) that fits around a pin on the laptop end, make SURE that the polarity is correct, otherwise it could be a real bad day.