<!DOCTYPE html>
<html>
<body>
<h2>Very Serious Alert!!</h2>
<script>
alert("Never Gonna Give You Up");
</script>
</body>
</html>
alert("Hello! I am an alert box!!");
//toastr Sweet Alert
//css
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.css" integrity="sha512-3pIirOrwegjM6erE5gPSwkUzO+3cTjpnV9lexlNZqvupR64iZBnOOTiiLPb9M36zpMScbmUNIcHUqKD47M719g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
//must have
var Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000
});
//how to use toastr:
Toast.fire({
icon: 'success', // error, info, warning
title: 'Successfully Created.'
})
//or
toastr.success('Successfully Created.') // error, info, warning
//js
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js" integrity="sha512-VEd+nq25CkR676O+pLBnDW09R7VQX9Mdiij052gVCp5yVH3jGtH70Ho/UUv4mJDsEdTvqRCFZg0NKGiojGnUCw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
alert("Your alert notification!");
alert("string");
// the hello world program
alert("Hello, World!");
alert("This is an alert !");
Alert.alert(
'Photo uploaded!',
'Your photo has been uploaded to Firebase Cloud Storage!'
);
<button onclick="alert('Hello! You clicked the button!');">
Click to Trigger Alert!
</button>
alert(varible);
alert("Example alert")
- Information : You can only accept.
- Confirmation: You can accept or decline.
- Prompt : You can accept, decline, and/or sendKeys.
3 types of JS Alerts
- Information : You can only accept.
- Confirmation: You can accept or decline.
- Prompt : You can accept, decline, and/or sendKeys.
<!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>Alert</title>
</head>
<script>
function alert() {
alert("Alert")
}
</script>
<body>
<button onclick="alert()">Alert</button>
</body>
</html>