Revision: 9688
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 17, 2008 20:45 by rareyman
Initial Code
/*
Validate target attribute XHTML Strict or HTML 4.0 Strict
http://www.flash-free.org/en/2008/05/17/validar-atributo-target-xhtml-strict-o-html-40-strict/
*/
// ==================================== with MooTools
function fix_external_links() {
$ES('a').each(function(el) {
if (el.getProperty('rel') == 'external') {
el.addEvent('click', function(e) {
e = new Event(e);
e.stop();
window.open(this.getProperty('href'));
}.bind(el));
}
});
}
window.addEvent('domready', function() {
fix_external_links();
});
// ==================================== without MooTools
function fix_external_links() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("rel") && anchor.getAttribute("rel") == "external") {
anchor.target = "_blank";
}
}
}
window.onload = fix_external_links;
Initial URL
http://www.flash-free.org/en/2008/05/17/validar-atributo-target-xhtml-strict-o-html-40-strict
Initial Description
Initial Title
Validate target attribute XHTML Strict or HTML 4.0 Strict
Initial Tags
javascript, textmate
Initial Language
JavaScript