0
嗨,所以我认为这可能是一个非常简单的问题,但我无法找到答案的任何地方。JavaScript到表中的一个单元格而不是整个页面
我有一个JavaScript函数,它从我的数据库拉动信息,我试图让它成为成一个表格的一个单元,但它输出到整个页面
的HTML
<tr>
<td class="tg-baqh" id='Emp1'></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control" id='shiftInput'></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control" id='shiftInput'></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control"></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control"></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control"></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control"></td>
<td class="tg-yw4l"><input type="text" placeholder="enter shift" class="form-control"></td>
<td class="tg-yw4l">30/16</td>
JavaScript的
$(function Emp1(){
// Get a database reference to our posts
var employeeref = new Firebase("https://shiftsapp.firebaseio.com/employees/emp1");
// Attach an asynchronous callback to read the data at our posts reference
employeeref.on("value", function(snapshot) {
console.log(snapshot.val());
document.write(snapshot.val());
}, function (errorObject) {
console.log("The read failed: " + errorObject.code);
});
});
这就是'document.write'的作用,它会覆盖文档? – adeneo
您需要从这里删除图像,并将代码本身作为问题的一部分发布。 – ManoDestra
@ManoDestra我已经添加了代码,并带走了图像。 – kelliehughesspare