There are several different definitions of dimension for a space. For instance, for any metric space there is associated the notion of Hausdorff dimension. A related notion is the Minkowski dimension of a metric space (which can never exceed the Hausdorff dimension). Yet another related concept is the packing dimension of a metric space. Another kind of dimension that is defined for any topological space is the covering dimension.
Each of these notions of dimension is motivated by some property, trying to formalize some aspect of the intuitive notion of dimension. It is then a theorem, for instance, that the covering dimension of $n$ dimensional Euclidean space is actually $n$. It is also the case that some of these notions of dimension (e.g., the Hausdorff dimension) can be fractional, and that it can be made to make sense.
For these notions of dimension, it is the case that the following is not a theorem: if $f:X\to Y$ is a continuous surjection, then $X$ and $Y$ have the same dimension. It simply is not true. Thus, the intuitive notion (at least intuitive to some) that the existence of such a function should entail the equality of dimensions does not agree with the formalisms above.
One can try to introduce a new notion of dimension, as follows. For spaces $X$ and $Y$ say that the dimensionality of $X$ is the same as the dimensionality of $Y$ if there exits a continuous surjection between the two spaces. This defines a relation on (ignoring set theoretic problems) the set of all spaces. The relation is clearly reflexive and symmetric, but not transitive. Its transitive closure is then an equivalence relations, and one may call the (again, ignoring set theoretic issues) equivalence classes 'dimensions'). Then the dimension of $X$ is simply $[X]$. It is then a trivial theorem that if $f:X\to Y$ is a continuous surjection, then $X$ and $Y$ have the same dimension. However, I doubt that this notion of dimension has any good properties.