Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AJAX填充文本框不工作_Javascript_Html - Fatal编程技术网

Javascript AJAX填充文本框不工作

Javascript AJAX填充文本框不工作,javascript,html,Javascript,Html,这是我的代码,为什么它不能填充输入文本框 <html> <head> <script> function textFill() { document.getElementById("textbox").value("Test Here"); } </script> </head> <body> <input type="text" id="textbox" /> <button type="button"

这是我的代码,为什么它不能填充输入文本框

<html>
<head>
<script>
function textFill() {
document.getElementById("textbox").value("Test Here");
}
</script>
</head>
<body>
<input type="text" id="textbox" />
<button type="button" onclick="textFill()">Fill Text</button>
</body>
</html>

函数textFill(){
document.getElementById(“textbox”).value(“此处测试”);
}
填充文本

你做得有点不对

document.getElementById("textbox").value = "Test Here";

请参见此JSFIDLE:

您的操作有点错误

document.getElementById("textbox").value = "Test Here";
请参阅此JSFIDLE:

尝试:

document.getElementById("textbox").value = "Test Here";
尝试:


firefox的web developer插件将来可能会帮助您解决类似的错误。firefox的web developer插件将来可能会帮助您解决类似的错误。