通过UI提供输入后,我无法在firebase数据库中看到数据。有人可以帮忙吗?
<body>
<input id="username" type="text" placeholder="Name"><br/>
<input id="text" type="text" placeholder="Message"><br/>
<button id="post">Send</button><br/>
<div id="results"></div>
<script>
var myFirebase = new Firebase('https://webchat-a778f.firebaseio.com/');
var usernameInput = document.getElementByID("username");
var textInput = document.getElementByID("text");
var postButton = document.getElementByID("post");
postButton.addEventListener("click", function() {
myFirebase.push(usernameInput + " says: " + textInput);
textInput.value = "";
},false);
答案 0 :(得分:1)
您有语法错误
应该是
document.getElementById
最后一个d是小写的