Paul Minty wrote:

> I'd like to see a microformat for this, and an external javascript, so
> that people who author these links without the aid of server side
> scripting can develop this user experience easily. Anyone seen anything
> like that?
> 
> Cheers
> Paul 
> 

heres a generic javascript function I wrote to open links in a new
window based on class name. It's only a partial solution to the pdf
issue but maybe someone will find it useful anyway.

just call it on dom load or window load with the class name you want to use:
setNewWindowLinks('new-win');

It'll hijack any 'a' tags with the class name you use and make them open
in a popup. If no javascript enabled then it'll just go to that link.
The 'a' tag can have multiple class names as well and it'll still work.

function setNewWindowLinks(className)
{
    var tags = document.getElementsByTagName('a');
    var re = new RegExp(className);
    if (tags.length > 0) {
        for (var i = 0; i < tags.length; i++) {
            if (tags[i].className.search(re) != -1) {
                tags[i].onclick = function()
                {
                    window.open(this.href, '_blank');
                    return false;
                }
            }
        }
    }
}


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to