Light a candle nearby before you start. The candle flame needs oxygen to burn, and so will suck in the onion fumes, leaving the air less toxic and less painful for your eyes. You'll probably still cry, but not as quickly and not as much. Once you've started cooking the onion you can blow the candle out.
Visit Rocks In My Dryer for loads more clever tips.