Here's a JavaScript example of generating HTML content. This HTML page contains a short JavaScript that prints out numbers from 1 to 9. Like this:
document.write("<p>"); for (var i=1; i< 10; i++) { document.write(i + " "); } document.write("<\/p>");