网页不显示创建的按钮是怎么回事?
复制的源码,为什么我的火狐浏览器还是一片空白
<script type="text/javascript"> var body = document.body; var input = document.createElement("input");
input.type = "button";
input.value = "创建一个按钮";
body.appendChild(input);
</script>
复制的源码,为什么我的火狐浏览器还是一片空白
<script type="text/javascript"> var body = document.body; var input = document.createElement("input");
input.type = "button";
input.value = "创建一个按钮";
body.appendChild(input);
</script>
2016-09-11
<html> <head> <meta charset="UTF-8"> <title>title</title> <script type="text/javascript"> function add() { var body = document.body; var input = document.createElement("input"); input.type = "button"; input.value = "创建一个按钮"; body.appendChild(input); } </script> </head> <body> <input type="button" value="add" onclick="add()"/> </body> </html>
举报