Is an onto function on $[0,1]$ continuous? 
Let $f:[0,1] \to [0,1]$.
  Suppose $f$ attains every value between $0$ and $1$ in the interval $[0,1]$,
  then does it mean that $f$ is continuous in the interval $[0,1]$?

The cosine function came to my mind in this example, but this example might have a counter-example.
Can you help me?
 A: Take 
$f(x) = \begin{cases}
2x,\quad &x \in \left[0,\dfrac 12\right]\\
1-\frac{x}{2},\quad &x\in\left(\dfrac 12,1\right]
\end{cases}$
$f$ is not continuous at $\frac{1}{2}$, but takes all the values between $0$ and $1$.
A: Take the Conway Base 13 Function $\mod 1$. This guy takes every value between $0$ and $1$ on any interval in $[0,1]$, and yet is not continuous.
A: $f(x)=2x$ ,$ x\in[0,1/2)$, $f(x)=2x-1, x\in [1/2,1]$ is a counterexample.
A: Just to add to the list here, consider: $$f(x) = x\cdot\left(1-\frac{|x-1/2|}{x-1/2}\right).$$
Or to take this example a slight step further:
$$f(x) = \frac{\lambda}{2} \cdot x\cdot\left(1-\frac{|x-1/\lambda|}{x-1/\lambda}\right).$$ for any $0 < \lambda < 1$.
A: For a simple one discontinuous at every point except $x=\frac 12$, let $I_{\Bbb Q}(x)$ be the Dirichlet function, which is $1$ if $x$ is rational and $0$ if $x$ is irrational.  Now let $$f(x)=xI_{\Bbb Q}(x)+(1-x)(1-I_{\Bbb Q}(x))$$
It is $y=x$ on the rationals and $y=1-x$ on the irrationals.
A: Define $f:[0,1] \to [0,1]$ as 
$$
f(x)=
\begin{cases}
x,\quad &x \in \left[0,\dfrac 12\right]\\
\frac 32-x,\quad &x\in\left(\dfrac 12,1\right]
\end{cases}
$$
Then $f$ is onto but discontinuous at $\frac 12.$
