0
点赞
收藏
分享

微信扫一扫

JavaScript实现提示框

耶也夜 2022-05-02 阅读 82

先弹弹窗后显示页面

<!DOCTYPE html>
<html>
<body>

<h1>一个页面</h1>
<p>一段文字</p>

<script>
window.alert("欢迎来到该页面!!");
</script>

</body>
</html>

 

点击按钮弹出弹窗

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Javascript</title>
</head>
<body>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
	alert("这是一个提示框");
}
</script>

</body>
</html>

点击按钮

 

 

举报

相关推荐

0 条评论