oh this is weird code. You should learn how to handle javascript variables. The "var" keyword is used for declaring a variable not for every access to it.
Code:
"'img/'+'var b'+'.jpg'"
is a literal string. Every single character of this string will be assigned to .src of the image. This is clearly not what you wanted to do
Try this instead
Code:
"img/" + b + ".jpg"
Then you are reading a string from the image .src attribute. You want to add 1 to this string? Clearly not. You want to extract the current number (or store it somewhere) and increase it by 1. You'll have to rethink your code ....