If you use JavaScript to dynamically generate a table, there will be a lotCode.
However, there are still few materials on the online style for dynamically generated tables, but I still find them.
Source: http://www.xhtmlhelp.net/javascript/15051.html
<! -- Inject script filtered -->
ThisIsParagraph #1.
ThisIsParagraph #2.
Parent. setattribute ("style", "text-align: Center ");
Bold. setattribute ("style", "text-align: Center ");
These two sentences are intended to center the text, but have no effect.
I tried for half a day and didn't find the cause, but I can replace the sentence with document. getelementsbytagname ("p") [0]. setattribute ("align", "center"); can achieve the same effect
Forfor2006-9-16Although in HTML But in JS, this is the form of element. style. textalign = "center"; instead of element. Style = "text-align: center ;"
P.s. do not place block-level elements (such as P) into inline-level elements (such as B). If you want to use element. style = "text-align: center;" format, which can be written
Element.style.css text = "text-align: center ;"
Parent. style. setattribute ("csstext", "text-align: Center ");
This kind of situation does not need to be shown and used, not like direct element.style.css text = "text-align: center ;"
//////////////////////////////////////// //////////////////////////////////////
Source: http://thinkway.spaces.live.com/Blog/cns! 1pbqqn3pamqciygnqvf99isa! 150. Entry
Use of setattribute in Javascript
I spent more than half a night! The style attribute is not implemented by a simple setattribute!
//////////////////////////////////////// /////////////////////////
If you want to add a CSS style table to a table:
Document. getelementbyid ("your settings"). classname = "your class"
<! -- Inject script filtered -->