How do you write No smoking on board or No smoking onboard?

The compound word 'onboard' is correct when referring to a ship, airplane, train, or any other vehicle.