I frequent message boards often, I know how often things can be repeated, so I apologize if this is already a well known trick, I'm new to this board.
If I am under the impression that a tank is going to kill me, and I have no equipment to take it out (often assualt), I usually take a chance at fooling the tank driver. Works best with only one person in the tank.
I simply run up to the side of the tank, throw some stuff around or in general just run around him(making sure not to be run over) until he jumps out assuming I have placed C4 on his tank. When the 'O' button on the tank appears, I hop in, back up, and usually am able to completely confuse and kill the original tank driver!
It doesn't always work, sometimes the gunner will jump out, and you have to multitask. But I have gotten this to work a lot. People panic and just jump out and RUN as fast as they can from the tank, which means I jump in, and blast 'em!