build up javascript to inject at the tail end of the page