I got some nice layout generator using jquery dynamic forms, and jquery ui features to change number of used elements, their css properties etc. Everything looks great but there
As a first step you can use
var $alteredHtml = $('html').clone(); // use jQuery here to make alterations to the cloned html (parse it)
but to save it you will need some server side technology, to either save it to a file or a database.