Javascript and HTML template