Note that the tbody element supports nesting function addMessage (messageID, userName, userCreateDate, articleCount, subject, body, creationDate, modifiedDate)
{
Var br;
Var row = document. createElement ("tr ");
Var cell = document. createElement ("td ");
Var cellTr = document. createElement ("tr ");
Var cellTd = document. createElement ("td ");
CellTd. appendChild (document. createTextNode ("userName:" + userName ));
CellTr. appendChild (cellTd );
Cell. appendChild (cellTr );
CellTd = document. createElement ("td ");
CellTd. appendChild (document. createTextNode ("created at: + userCreateDate "));
CellTr. appendChild (cellTd );
Cell. appendChild (cellTr );
CellTd = document. createElement ("td ");
CellTd. appendChild (document. createTextNode ("published:" + articleCount ));
CellTr. appendChild (cellTd );
Cell. appendChild (cellTr );
Row. appendChild (cell );
Cell = document. createElement ("td ");
CellTr = document. createElement ("tr ");
CellTd = document. createElement ("td ");
CellTd. appendChild (document. createTextNode ("published on:" + creationDate + "" + "modified on:" + modifiedDate ));
CellTr. appendChild (cellTd );
Cell. appendChild (cellTr );
CellTr = document. createElement ("tr ");
CellTd = document. createElement ("td ");
CellTd. appendChild (document. createTextNode (subject ));
Br = document. createElement ("br ");
CellTd. appendChild (br );
CellTd. appendChild (document. createTextNode (body ));
CellTr. appendChild (cellTd );
Cell. appendChild (cellTr );
Row. appendChild (cell );
Document. getElementById ("messageList"). appendChild (row );
}
The above code shows "accidentally calling methods or attribute access" in ie. The error points to the last sentence.
Rating:
Your code is not elegant ~ No reusability ~ Performance base ~ ,
Suggestion:
1> function encapsulation is used for reuse.
2> the internal nesting of the table adopts the following format:
Dynamically generate a table using an internal to external addition scheme. Use document. createTextNode as little as possible, with low performance.
3> if your table is not executed during page loading, we recommend that you