Nick Fitzsimons wrote:
> Word boundaries aren't right either; for exmple, they will match a
> hyphen, so matching on some-thing will match some-thing-else. As per the
> HTML spec, class names are space-separated, so you need to match on
> spaces and the beginning or end of the string.
> 

of course, class names are separated by whitespace so hopefully this is
it...

function setNewWindowLinks(className)
{
    var tags = document.getElementsByTagName('a');
    var re = new RegExp('\\s' + className + '\\s');
    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