我需要创建表格head.How我可以写使用document.write。我尝试了<thread>
标签,但它不工作?
<script type="text/javascript">
function btnCallWCF_onclick() {
Service.getproprttydatasdata(onSuccess);
}
function onSuccess(response) {
debugger;
document.write('<table border="1" cellspacing="1" cellpadding="5"><thead><tr>Address</tr><tr>Address</tr><tr>Address</tr>')
for (i = 0; i < response.length; i++) {
document.write('<tr>')
document.write('<tr>' + i + '</td>')
document.write('<td>' + response[i].Address + '</td>')
document.write('<td>' + response[i].Address + '</td>')
document.write('<td>' + response[i].Address + '</td>')
document.write('</tr>')
}
}
</script>
发布于 2014-12-19 15:37:29
尝试以下操作:
<script type="text/javascript">
function btnCallWCF_onclick() {
Service.getproprttydatasdata(onSuccess);
}
function onSuccess(response) {
debugger;
document.write('<table border="1" cellspacing="1" cellpadding="5"><thead><tr><th>Address</th><th>Address</th><th>Address</th><th>Address</th></tr></thead>'); // There is 1 row with 3 headings.
for (i = 0; i < response.length; i++) {
document.write('<tr>')
document.write('<td>' + i + '</td>') // Changed <tr> to <td>
document.write('<td>' + response[i].Address + '</td>')
document.write('<td>' + response[i].Address + '</td>')
document.write('<td>' + response[i].Address + '</td>')
document.write('</tr>')
}
}
</script>
https://stackoverflow.com/questions/27561456
复制相似问题