Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1566 When displaying an alert, how can I close the alert box and send the user to a certain page when they click OK?

You are here: irt.org | FAQ | JavaScript | Misc | Q1566 [ previous next ]

You can generate an alert message when the user clicks a link:

<a href="somepage.html" onClick="alert('You are now leaving my site')">Click here</a>

Or you could use a confirmation dialog box to confirm the request:

<a href="javascript:if (confirm('Are you sure')) location = 'otherpage.html'">Click here</a>

©2018 Martin Webb