How To Create A JavaScript Close Link
Whenever I create a small JavaScript popup window, I offer a "close" link. Since I'm responsible for the new window, I feel it's my job to help them easily get rid of it.
The XHTML
Create an anchor with the JavaScript "close" call in the "href" attribute:
Close Window
Do not use the onClick attribute of the anchor because not everyone clicks links.
Note: I've gotten out of the habit of using JavaScript popups. They're annoying and as smooth as steel wool. I recommend using a modal box via JavaScript. Most modal box scripts allow for smooth transitions and are just as easy to close as popup windows -- plus, they don't get blocked by popup blockers. I currently use MoodalBox for my projects.
I remember the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener
and attachEvent
. Times have changed but there are still a few functions each developer should...
Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...
A few weeks back, jQuery expert Janko Jovanovic dropped a sweet tutorial showing you how to create a Skype-like button using jQuery. I was impressed by Janko's article so I decided to port the effect to MooTools.
The XHTML
This is the exact code provided by...