The onClick Event

I know that onMouseOver becomes an event when the mouse is passed over a link. (BTW, it can be used in other places, not just over links.) Likewise, onClick would be an event where the user clicked the mouse button. So, one would think that the script should be just as successful when using onClick Event Handler. Below is an example of the code for it, using the alert method with it:

HTML file: Displayed by browser:
<body>

<A HREF="http://www.htmlgoodies.com" target="_blank"
onClick="alert('You are off!');">Click Here</A>

</body>
Click Here

Aha!! The solution to my assignment #5 problem!! I just had the wrong event. Note: The alert text uses "You are" instead of "You're". There is a reason for that. The second phrase would have caused an error because the browser would have seen that apostrophe as the end of the text. The alert box would not have appeared because the browser would not have understood the stuff after the apostrophe. Logical.

BackTable of ContentsNext