日期:2014-05-16 浏览次数:20397 次
var list = document.getElementById('content'); for(var i=0;i<10;i++){ var item = document.createElement('li'); list.appendChild(item); item.appendChild(document.createTextNode('item'+i)); }
var list = document.getElementById('content'); var fragment = document.createDocumentFragment(); for(var i=0;i<10;i++){ var item = document.createElement('li'); fragment.appendChild(item); item.appendChild(document.createTextNode('item'+i)); } list.appendChild(fragment);
var createDatagrid = function(rows) { var html = []; html.push('<table width="631" border="0" cellspacing="1" cellpadding="0">'); html.push('<tbody'>); for (var i = 0; i < rows.length; i++) { html.push('<tr onmouseover=\'this.style.backgroundColor="#FAFAFA";\' onmouseout="this.style.backgroundColor=\'\';" style="text-align:center;">'); html.push('<td align="center" height="22">' + rows[i].user_name + '</td>'); html.push('<td align="center">' + rows[i].type_id+ '</td>'); html.push('<td align="center">' + rows[i].send_time+ '</td>'); html.push('<td align="center">' + rows[i].gps_time)+ '</td>'); html.push('<td align="center">' + rows[i].speed + '</td>'); html.push('<td align="center">' + rows[i].course + '</td>'); html.push('<td align="center">' +rows[i].gps_status+ '</td>'); html.push('</tr>'); } html.push('</tbody>'); html.push('</table>'); document.getElement.innerHTML = html.join(""); }