One of the ways to dynamically execute Javascript codes is by using hyperlinks. The trick is to use a URL starting with javascript:, followed by the Javascript code itself.

The URL can be in the image, link, or CSS style, and in the example below, an alert will pop up when the link is clicked;

<a href="javascript:window.alert('Red Alert')">
Click here
</a>
Discuss the article:

Comment anonymously. Login not required.

Share!