This is kind of a strange way to run some JavaScript really quick when someone clicks a link. And it doesn’t work if the users browser is set to disable all JavaScript, even though it might look like a sneaky way to add some JavaScript to a page like that.
Here’s an example:
<a href="JavaScript:document.bgColor='#eeeeee'> Click to make background grey! </a>
This is a trick that might not appear useful, but it might make your life slightly easier in the long run, if you’re someone who likes to avoid onclick=”” attributes.
To be honest, this is more of a fun tidbit than a useful tool. But it’s funny that it is allowed, and has been a thing for a long time.