Unfortunately there isn't much you can do except try and redirect him which may tick him off more. It's a phase he'll get out of, he likes seeing your reaction when he whacks his head on the floor. You panic and are running to him, it's probably a little bit of a game to him. My daughter did that and when I started ignoring her she quit. She is fine.