One way to avoid this is to have the server generate the HTML you want to you and sent that back to the browser. Then, you could use the innerHTML property to update existing HTML with the HTML generated on the server.
Server side technologies like PHP, JSP, and ASP are generally much easier to work with when creating HTML content rather than string concatenation.
Ryan Asleson<br />Co-Author, <a href="http://www.amazon.com/Foundations-Ajax-Foundation-Ryan-Asleson/dp/1590595823/sr=1-1/qid=1158926537/ref=pd_bbs_1/002-7412154-2924860?ie=UTF8&s=books" target="_blank" rel="nofollow">Foundations of Ajax</a> and <a href="http://www.amazon.com/Pro-Ajax-Java-Frameworks/dp/1590596773/ref=sr_11_1/002-7412154-2924860?ie=UTF8" target="_blank" rel="nofollow">Pro Ajax and Java Frameworks</a><br /><a href="http://taconite.sf.net" target="_blank" rel="nofollow">Taconite</a> Lead Developer
I wrote a taglib to display a calendar (just what the world needs another calendar obj) only because the free one I got off the web mysteriously stopped working. The page is rendered and the taglib generates a hidden calendar object. When the user hits an img button the calendar shows.