<script>
function checkConnection() {
if (navigator.onLine) {
swal("Great News" , 'Congratulation your connection is online', "success");
document.getElementById('image').src = 'online.jpg';
} else {
swal("Sad News" , 'Can you please connect to the internet to login', "error");
document.getElementById('image').src = 'offline.jpg';
}
}
</script>
Introducing a dynamic image swapping feature based on the user's online or offline internet connection status.