<input type="number" id="myNumber" placeholder="Favorite Number"> <p>点击按钮显示 number 字段的提示信息。</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myNumber").placeholder; document.getElementById("demo").innerHTML = x; } </script>