What is the difference between a surjective and a continuous function? What is the difference between a surjective and a continuous function? 
If a function is surjective then it takes all values so it is continuous and also if a function is continuous then it takes all values then it is surjective :( ?
Definition: A function $f : X\to Y$ between sets is surjective if for every $y\in Y$, there exists $x\in X$ such that $f(x) = y$. This means that every $y$ is hit by something in $x$ under $f$. As you said, this means $f$ takes on all possible values.

Definition: A function $f : (X,\tau_X)\to (Y,\tau_Y)$ between topological spaces (not just sets!) is continuous if for every $U\in\tau_Y$, $f^{-1}(U)\in\tau_X$. If you call the elements of the topologies open sets, this says that the preimage of an open set is open. This definition generalizes the definition found in calculus classes ($f : \mathbb{R}\to\mathbb{R}$ is continuous at $a\in\mathbb{R}$ if $f(a) = \lim_{x\to a}f(x)$).

There are many differences between these definitions. For one, you can talk about a function being surjective if the domain and codomain are simply sets, but you cannot talk about a function being continuous unless the domain and codomain are topological spaces. It's easy to find examples of functions that satisfy any chosen combination of these properties:


Continuous but not surjective: Consider the constant map $f : \mathbb{R}\to\mathbb{R}$ defined by $f(x) = 0$. This is continuous, but very far from surjective (for example, no $x$ satisfies $f(x) = 1$).
Surjective but not continuous: Let $f : \mathbb{R}\to\mathbb{R}$ be defined by 
$$
f(x) = \begin{cases} 1/x &amp; \text{if }x\neq 0, \\
0 &amp; \text{if } x=0, \end{cases}
$$
This function is surjective, but not continuous (there's "bad stuff" happening at $0$!).
Continuous and surjective: Let $f : \mathbb{R}\to\mathbb{R}$ be the identity function; i.e., $f(x) = x$. $f$ is both surjective and continuous.
Neither continuous nor surjective: Let $f : \mathbb{R}\to\mathbb{R}$ be given by 
$$
f(x) \begin{cases} 1 &amp; \text{if }x\in\mathbb{Q}, \\
0 &amp; \text{if } x\in\mathbb{R}\setminus\mathbb{Q}, \end{cases}
$$
Then $f$ is neither continuous nor surjective (the function jumps around all over the place, and only hits the values $0$ and $1$).
Function is continous at a if $\lim\limits _{x\to a}f(x) = f(a)$ by definiton.
On the other hand function $f:A \to B$ is surjective if range of f is whole set B.Thus there is no relation between continuity and surjectivity