It's not a crazy idea, just an old crude one - they were commonly used to drive valve radios in cars back in the 1950's, special relays called 'vibrators' were used. Two basic types were available, syncronous and non-syncronous, syncronous ones had extra contacts which rectified the secondary for you.
There are various designs for inverters on the internet, but some of them are too simple to work, and would be nothing but trouble. A good efficient inverter is a fairly complicated device to build!.