Since the solution on the website you linked to uses Jaascript, I’ve moved your question to the JS forum.
Anyway, if you take a look at the html code of that page, you can see exactly how they did it.
Is there anything specific with that code you don’t understand?