How do I check if an Anchor has ID via javascript?

I Have the following code:


document.onclick = function (e) {
e = e || window.event;
var element = e.target || e.srcElement;

    if (element.tagName == 'A' && element.tagName != document.getElementById('teste')) {
        window.open(element.href, "_blank", "location=no");
        return false;
    }
};

How can I exclude elements that has an ID? like

Thanks!