Using JavaScript, replicate the functionality found here.
The solution does not have to be perfect. Most important is to see how you approach such tasks.