What is the method of praying when you are travelling in a car or aeroplane?

If you can stop the car and pray then it is necessary to do so.

In a plane, one should try to offer the salah in the usual way if possible, but if not, then standing up to do Takbir followed by sitting at the seat and bowing slightly for Ruku and then sajdah on the tray table will suffice.