window.alert("11111111111")
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// alert
window.alert("11111111111")
</script>
</body>
</html>
confirm 是在浏览器弹出一个询问框
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id = "btn">click</button>
<script>
btn.onclick = function(){
var res = confirm("确定要删除吗?")
console.log(res)
}
</script>
</body>
</html>
prompt 是在浏览器弹出一个输入框
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id = "btn">click</button>
<script>
// 输入框 prompt
btn.onclick = function(){
var res = prompt("请输入你的姓名?")
console.log(res)
}
</script>
</body>
</html>
标签:prompt,res,出层,JS,---,输入框,alert,浏览器,Document From: https://blog.csdn.net/weixin_58694594/article/details/142603171