The confirm box used to display a message and return a true
or false value. Now create a web page named confirmBoxUse.html which shows the
use of the confirm box.
###### Showing the code for the confirmBoxUse.html file
#####
<!DOCTYPE html>
<html>
<head>
<title>Using The confirm box</title>
</head>
<body>
<SCRIPT type=”text/javascript”>
var qry=(“Are you sure to send this file to Recycle Bin ?”);
if(qry)
document.write(“Welcome to JavaScript.<br/> You have
moved the file to Recycle Bin.”);
else
document.write(“Welcome to JavaScript<br/> The file is
not Moved”);
</SCRIPT>
</body>
</html>
We can observe that the var variable stores the value of the
query based on whether we click the ok or the Cancel button.
######Shows the output of the confirmBoxUse.html file ######
When you click the ok button a message appears on the Web
page.
No comments:
Post a Comment