You can use getElementsByClassName
and select the first element, because this method returns a list of Elements which is ordered by the position of the elements in the DOM.
So, given that the element you want to get is the first one that appears in your HTML code with that class, you can do:
document.getElementsByClassName("news-image")[0]
And if it isn't the first one, you can change the number and select another element:
document.getElementsByClassName("news-image")[2] // third element
You can also use querySelector
to select the first element that matches the given CSS selector, which is, in my opinion, easier:
document.querySelector("img.news-image")
Finally, since I see you're using jQuery as well, you can use it's selector like this:
$("img.news-image")[0]
Talking about your specific code, here's the solution you were looking for:
$(".news-button").click(function(){
var img = $('img.news-image')[0];
if (img.src.indexOf('news-bt-1.png')!=-1) {
img.src = 'img/news-bt-2.png';
}
else {
img.src = 'img/news-bt-1.png';
}
});