My proof:
I shall use the fact that the image of a closed interval under a continuous function is a closed interval (this follows from the Extreme and Intermediate Value Theorems).
Let $c,d\in (a,b)$, $c
Can this argument be simplified?
EDIT: We can possibly have that $a=-\infty$ or $b=+\infty$