1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 </head> 7 <body> 8 <script> 9 function core(){ 10 var salary=Number(prompt("请输入您的工资")); 11 salary+=1000; 12 console.log("涨工资后:"+salary);} 13 </script> 14 <!--通过一个按钮,来调用calSalary函数--> 15 <button onclick="core()">计算工资</button> 16 <button onclick="core()">点击一下</button> 17 </body> 18 </html>