日期:2014-05-18 浏览次数:20548 次
function Table_Add_Row(TableID,Message,Style) { var l_Table = document.getElementById(TableID); var l_NewRow = l_Table.insertRow(); var l_NewCell = l_NewRow.insertCell(); l_NewCell.innerHTML = Message; //分解style以赋给新增单元 var l_SeparatedStyle = []; l_SeparatedStyle = Style.split(';'); var l_StyleNum = l_SeparatedStyle.length; var i = 0; debugger; for(i=0;i<l_StyleNum;i++) { var l_Style = l_SeparatedStyle[i]; var l_SeparatedStyleElement = []; l_SeparatedStyleElement = l_Style.split(":"); var l_ElementName = l_SeparatedStyleElement[0]; var l_ElementContent = l_SeparatedStyleElement[1]; debugger; if(l_ElementName == "text-align") { l_NewCell.style.text-align = l_ElementContent; } if(l_ElementName == "color") { l_NewCell.style.color = l_ElementContent; } if(l_ElementName == "font-size") { l_NewCell.style.font-size = l_ElementContent; } if(l_ElementName == "font-family") { l_NewCell.style.font-family = l_ElementContent; } if(l_ElementName == "background-color") { l_NewCell.style.background-color = l_ElementContent; } } }