hasAttribute non funziona su IE
usa getAttribute invece (crossbrowser)

codice:
if (elemento.getAttribute('attributo') {
 ...
}

Ciao.