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 :( ? 
 A: 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 & \text{if }x\neq 0, \\
0 & \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 & \text{if }x\in\mathbb{Q}, \\
0 & \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$).

A: The function $f:[0,1]\to[0,1]$ defined by
$$
f(x) = \begin{cases} 2x & \text{if }0\le x\le 1/2, \\
2x-1 & \text{if } 1/2<x\le 1, \end{cases}
$$
is surjective but not continuous.
The function $f:[0,1]\to[0,1]$ defined by
$$
g(x) = \frac x {10}
$$
is continuous but not surjective.
The function $x\mapsto x^2$ from the set of all rational numbers into itself is continuous and not surjective, and does not even take all intermediate values between two of its values: $1\mapsto 1$ and $2\mapsto 4$ but no rational number between $1$ and $2$ is mapped to $2$, which is a rational number between $1$ and $4$.
Suppose you're considering functions from the set $\{1,2,3\}$ into the set $\{1,2,3\}$.  Some such functions are surjective and some are not, but all are continuous.
A: A function $f: X \to Y$ takes elements from $X$ as input, and when you have in input from $X$, $f$ gives you an output in $Y$.  You can think of $f$ as "sending" the input $x$ from $X$ to its output $f(x)$ in $Y$.  $X$ is called the domain of $f$, and $Y$ is called the codomain of $f$.
A function is surjective if every element of the codomain $Y$ has some element of the domain $X$ being sent to it.  Here is a picture of a surjective function with $X = \{ 1, 2, 3, 4\}$ and $Y = \{ D, B, C \}$ (source):

A function is continuous at a point $x \in X$ if for every $\epsilon > 0$, there is some $\delta > 0$ such that $|x - y| < \delta$ implies $|f(x) - f(y)| < \epsilon$.  In some sense, this is saying that $f$ is continuous at a point $x \in X$ if any point "near" x will have output "near" $f(x)$.  Remember that $| a - b|$ can be interpreted as the "distance" between $a$ and $b$ (if, for example, $a, b$ are in $\mathbb{R}$).
See the other answers for examples of functions that are continuous but not surjective, and functions that are surjective but not continuous.  Hopefully you can see from my explanations above that the ideas of "surjective" and "continuous" do not depend on each other.
A: 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 
