basic one-page javascript implementation