<script>
var username = prompt('姓名');
var age = prompt('年龄');
var sex = prompt('性别');
alert('姓名' + username + '\n' +
'年龄' + age + '\n' +
'性别' + sex + '\n');
</script>
运行结果:
标签:username,prompt,换行,age,sex,JS,var,alert
来源: https://www.cnblogs.com/Ynline/p/15897875.html