function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Dynamic table creation with visualforce & javascript

Ok, so I'm trying to create tables based on strings i have in a couple of parallel arrays using visualforce.  My code is good, but when I run it, strange things occur:

tableText+="<tr><td class='included' onClick=\"toggleObj("+i+", '"+ObjArr2[i]+"', this)\" colspan='2' onMouseOver='flipOn(this)' onMouseOut='flipOff(this)' id='"+ObjArr[i]+"TD'><span class='fieldhdr'>"+ObjArr2[i]+" Object</span></td></tr>";


tableText+="<tr><td class="included" colspan="2" id="&quot;+ObjArr[i]+&quot;TD" onMouseOut="flipOff(this)" onMouseOver="flipOn(this)" onClick=\"toggleObj("+i+", '"+ObjArr2[i]+"', this)\"><span class="fieldhdr">"+ObjArr2[i]+" Object</span></td></tr>";

Quotation marks are turned into &quot; and it totally re-arranges things, puts double quotes instead of singles, and I don't understand why.  I've tried putting \ in front of the ', and this does prevent the text from being re-arranged but throws the same error in firefox: "Missing ; before statement"  This would be incredibly useful for me, and make my page much more dynamic.  Is there a workaround?
Ron HessRon Hess
I think the tag   < apex :  PageBlockList   will build a list just like you want without the quoting.

May I know how you pass the tableText to VF page and display as a table?