I'm not so sure myself because of how tall we are. The magnetic field would have to be a lot stronger on one part of our bodies compared to the rest, and that unevenness would probably cause problems. Magnetic Fields drop in power very quickly, I don't remember the exact formula, but it was like 1/4 their strength when you doubled their distance. Also, if you are using electromagnets, the amount of power you'd need would mean we'd have to either get a lot of power from an outside source, or store enormous amounts of energy. If you are using natural magnets, well, I don't know how you'd make magnets that powerful.
The other forms of alternative gravity we use in spaceships are much better than this currently (in my opinion). We use spinning to cause artificial gravity. This doesn't use much power to maintain the spinning once you've started it, and the gravity is not as uneven on our bodies. Depending on where you are, the gravity is different though, but that's the same thing with the magnets, right?