Timothy van Sas is very good in webdesign, xhtml, css and smooth dancing

RSS FeedPopup with unobtrusive javascript

If you don’t know why to use unobtrusive javascript i think it’s wise to read about the advantages.
jQuery is the perfect library with a low learning curve for a new unobtrusive way of writing and using javascript.

Normally you would use an onclick for creating a popup, this method can only be executed when the whole page is loaded, including all images.

Let’s do it the jQuery way! This will be executed as soon as the DOM is ready.

jQuery code

		$(function() {
			$('a.popper').click(function() {
			var href = $(this).attr('href');
			window.open(href, 'popup', 'height=500,width=400,toolbar=no');
			return false;
			});
		});

The HTML

<a href="http://www.google.com"" class="popper">Link to open popup</a>

$('a.popper') uses a CSS selector to traverse the DOM.