This doesn’t work in my browser – is this normal? It only works when I declare the alias for the document Object inside the function someFunc scope.
var pic1 = document.getElementById('pic1');
var someFunc = function () {
pic1.style.left = "100px";
}
Yes. You just need to ensure you are calling
someFuncafter thepic1element has loaded on page. On that note, it’s best practice to put you JavaScript at the bottom right before the closingbodytag.Check your code out in action – http://jsfiddle.net/dga9k/1/