Surprisingly enough, there are a few papers on this (like here). So other people have considered variations of this problem.
I think that you should also be familiar with a related but incredibly interesting fact: it is possible to have a continuous function that has a local maxima/minima at every rational number. That's a dense subset, which is astounding enough as it is. (One should note that having a countable number of local maxima is all one can ask for. To see this, note that around every maxima one can assign an interval over which it is the maximum, from the definition of a local maximum. But there is a rational number in this interval, and so there can be at most countably many).
One such function is the Weierstrass function. It seems not so hard to alter this so that it has countably many maxima and minima, but no global maxima or minima.