First page Back Continue Last page Image
- onbeforeunload Event Example
- <!DOCTYPE html>
- <html>
- <head>
- <title>FabulousAirTickets.com</title>
- <script src="script02.js"></script>
- </head>
- <body>
- <h2>FabulousAirTickets.com</h2>
- <form action="#">
- <p>
- <label for="from">From:</label> <input type="text" id="from">
- <label for="to">To:</label> <input type="text" id="to">
- </p>
- <p>
- <label for="leavedate">Departure Date:</label> <input type="date" id="leavedate">
- <label for="returndate">Return Date:</label> <input type="date" id="returndate">
- </p>
- <p>
- # of Adults:
- <select>
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- <option value="4">4</option>
- </select>
- </p>
- <p>
- <input type="submit" value="Find Flights!">
- <input type="reset">
- </p>
- </form>
- </body>
- </html>
- window.onbeforeunload = function() {
- return "If you close this window, your flight choices will be lost!";
- }