The interesting thing is about what can't happen. There are definitely continuous functions from $\mathbb{R}$ to $[-1,1]$ (i.e. their range is confined there). There are also continuous functions from $\mathbb{R}$ onto $[-1,1]$ (i.e. their range is $[-1,1]$). These two are exemplified by $\sin(x)$.
There are also injective continuous functions from $\mathbb{R}$ into $[-1,1]$ (i.e. their range is confined there). This is exemplified by $\tanh(x):=\frac{e^x-e^{-x}}{e^x+e^{-x}}$.
But there are not injective continuous functions from $\mathbb{R}$ onto $[-1,1]$. Such a function is either a homeomorphism (impossible: $\mathbb{R}$ is not compact and $[-1,1]$ is) or has a discontinuous inverse (also impossible because of a property particular to $\mathbb{R}$ and intervals).
Notably, it is easy to lose this particular property of $\mathbb{R}$ and intervals. For example there is a continuous injective function from $[0,2\pi)$ onto the unit circle, and yet $[0,2\pi)$ is not compact whereas the circle is.