<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script> var name =prompt('请输入您的姓名'); var sex =prompt('请输入您的性别'); var age =prompt('请输入您的年龄'); age = parseInt(age); alert(name); alert(sex); alert(age); </script> </head> <body> </body> </html>
注意age要转化为数字