为了方便信息的输入输出,js提供了输入输出语句,常用的如下:
1、alert(msg)【浏览器弹出警示框】
2、console.log(msg) 【浏览器控制台输出内容】
3、prompt(msg) 【浏览器弹出输入框,提供用户进行输入】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>js注释</title>
<script>
//这是一个输入框
prompt('请输入您的姓名!');
//弹出警示框 输出展示给用户的
alert('1、我是alert!');
//控制台输出 程序员测试使用
console.log('我是测试日志!');
</script>
</head>
<body>
</body>
</html>
评论前必须登录!
注册