xxx.js
tableCreationForQuoteItem();
function tableCreationForQuoteItem()
{
var html_str='';
html_str += '<table>';
html_str += '<tr>';
html_str += '<th>Item</th><th>Description</th><th>Unit Cost</th><th>Tax Rate</th><th>Unit Of Measurement</th>';
html_str += '</tr>';
html_str += '<tr>';
html_str += '<td>'+$('#Quote_quoteitem_name') +'</td>';
html_str += '<td>'+$('#Quote_description') +'</td>';
html_str += '<td>'+$('#Quote_unitcost') +'</td>';
html_str += '<td>'+$('#Quote_taxrate_value') +'</td>';
html_str += '<td>'+$('#Quote_uom_value') +'</td>';
html_str += '</tr>';
html_str += '</table>';
alert(html_str);
}
我收到警报。但我想将此表放在某个字段中,例如 Quote_item。如何做到这一点?请有人帮忙。
最佳答案
使用 JQuery -
$('#Quote_item').html(html_str);
并使用 JavaScript -
document.getElementById("Quote_item").innerHTML = html_str;
关于javascript - 页面加载时设计表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24817497/