我想实现,输入数字,点击按钮就进行转换,同时在另外一个输入框显示答案。
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script> window.onload=function change(){ var num =document.getElementById("number").value; var result =document.getElementById("result").value; result =Math.ceil(num); return result; } </script> </head> <body> <form> <input type="text" value="" placeholder="请输入数字" id="num"> <input type="text" value="" placeholder="答案" id="result"> <button type="button" onclick="change()">change</button> </form> </body> </html>