<!DOCTYPE html>
<html>
<body>
<a class="AAA">X</a>
<a class="test">Test</a>
<a class="BBB">X</a>
<script type='text/javascript'>
HTMLElement.prototype.getElementsByClassName = function (classname) {
return this.querySelectorAll('.' + classname);
};
document.body.getElementsByClassName('test')[0].style.color = 'red';
</script>
</body>
</html>