Your host:
Stephen Chapman
Stephen Chapman

Generating HTML

Question: I like to know whether javascript can create input element such as text, button or drop down list dynamically?
Chester Heng

Answer: You can create HTML dynamically with Javascript by placing the HTML inside document.write(''); statements. Many of the Javascripts on my site do just that to add dynamic features to the page.

What Javascript can't do on most browsers is to dynamically add HTML elements to an existing page without refreshing the page (it can be done on some browsers but that only makes it useful where you control which browser all of your visitors use). My page Your Favourites demonstrates how much you can achieve by having the Javascript build part of the page and dynamically reload the page whenever it changes.

go to top

Add to del.icio.us

Mortgage - Renegade motorhomes - Cheap Car Insurance - Cheap Flights