Ted Drake wrote:
Jeremy Keith recently spoke about using the class in the link to target a javascript to add the behavior, leaving a nice, clean link.

In the case of PDFs opening in a new window, you might not even need to add a class. You could write a function that looks for the file extension .pdf in the href attribute and open that link in a new window. Something like this:

function preparePDFlinks() {
    if (!document.getElementsByTagName);
    var lnks = document.getElementsByTagName("a");
    for (var i=0; i<lnks.length; i++) {
        if (lnks[i].getAttribute("href").indexOf(".pdf") != -1) {
            lnks[i].onclick = function() {
                return !window.open(this.href);
            }
        }
    }
}
window.onload = preparePDFlinks;

I haven't tested that: it's just an idea really.

--
Jeremy Keith

a d a c t i o

http://adactio.com/

******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************

Reply via email to