function getElementsByAttrValue(value) {
var matchingElements = [];
var allElements = document.getElementsByTagName('*');
for(var i = 0, n = allElements.length; i < n; i++) {
for(var j = 0, m = allElements[i].attributes.length; j < m; j++) {
if(allElements[i].attributes[j].value == value) matchingElements.push(allElements[i]);
}
}
return matchingElements;
}