This is an example of htmlbuilder. Below is HTML dynamically generated with htmlbuilder.js
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="htmlbuilder.js"></script>
<script type="text/javascript" charset="utf-8">
YAHOO.util.Event.onDOMReady(function(){
var HTML = YAHOO.treyruncie.html;
HTML.write(
HTML.contentTag('div',{'class':'divFromScript'},
'DIV and input from script',
HTML.tag('br'),
HTML.contentTag('label',{'for':'sample'},
'label for sample',
HTML.tag('input',{'value':'hello world','name':'sample'})
),
HTML.tag('br'),
'DIV and input from script'
),
'targetID','insertAfter'
);
});
</script>