Jump to content

How to display an alertbox when clicked on a link?


Guest jstratham84

Recommended Posts

Guest jstratham84

Hello,I want to display an alert box when clicked on a link. I found out how to do this with left click (on w3schools), but how can I make it so that this alertbox is display both on right and left click?

Link to comment
Share on other sites

This would do it for IE, im not sure how you would do it with the other browsers :)

<html><head><script type="text/javascript">function Alert(){if (event.button == 2)alert("Right Click Pressed")else alert("Left Click Pressed");}</script></head><body><a href="#" onmousedown="Alert()">Click Me</a></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...