我在登錄頁面後運行以下腳本。如果用戶第一次訪問該網站,則會顯示以下消息。在初次和後續訪問中使用localStorage顯示消息
<script src="dist/sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="dist/sweetalert.css">
<script>
if (!localStorage['done']) {
localStorage['done'] = 'yes';
swal({ title: "Getting Started", text: "Tap 'Select a Task' from the top menu to get started or watch the training video.", type: "info", confirmButtonText: "Got It!", animation: "slide-from-top" });
}
</script>
現在,我想如果它不是他們的第一次訪問,在彈出窗口中顯示不同的消息。 else
要走的路,如果是這樣,什麼是正確的語法?
謝謝!我已經嘗試過,但沒有把之前的其他。我知道我做錯了什麼,只是無法弄清楚什麼。謝謝。 –