2010 Nissan Maxima goes on and off

My check engine light comes on than just goes off i change the o2 sensor and crankshaft senor why light still comes on and off

Pleas post the code numbers you are getting.