当前位置:网站首页>Confirm() method of window

Confirm() method of window

2022-07-01 00:24:00 Super Baa Baa

confirm() Method is used to display a Specify the message and Confirm and Cancel buttons The dialog .

 

If the visitor clicks " determine ", This method returns true, Otherwise return to false.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>confirm</title>
</head>
<body>


<button onclick="myFunction()"> What to eat tonight ?</button>
<p id="demo"></p>
<script>
function myFunction(){
	var x;
	var food=confirm(" Pizza hut !");
	if (food==true){
		x=" Pizza Hut tonight !";
	}
	else{
		x=" You don't want pizza hut tonight !";
	}
	document.getElementById("demo").innerHTML=x;
}
</script>

</body>
</html>

 

原网站

版权声明
本文为[Super Baa Baa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202160431474202.html