我特林让文本输入与后续代码值的值:的document.getElementById( 'url_input')值未打印
var input = document.getElementById('url_input').value;
和
document.getElementById("send_url").onclick = function(){
console.log(input);
}
这并未不工作,但如果我改变像这样:
var input = document.getElementById('url_input');
document.getElementById("send_url").onclick = function(){
console.log(input.value);
}
这两个有什么不同?为什么第一个不工作?
请张贴您的HTML。 –
存储值与读取值。 – epascarello
请填写完整的html,但似乎是在输入值设置之前存储输入值 –