Register JavaScript in a page