Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Misc | Q1566 [ previous next ]

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 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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.