I know using something like document.getElementById("img1").attribute is an standard way to access to elements, but what about img1.attribute? Is it OK to use it? 
Few years ago I used to use NameValue.attribute (I mean when I had an element like this <input name="NameValue">) to get and set elements attributes but today I tested it on FF and it didn't work. So I tested IdValue.attribute on IE, FF and Chrome and it worked.