javascript - document.getElementById("someId") Vs. someId -


this question might seem silly, what's difference between accessing element (with id "someid") using document.getelementbyid("someid") vs. typing someid ?

eg:

document.getelementbyid("someid").style.top = "12px"; 

vs

someid.style.top = "12px"; 

here's sample code http://jsfiddle.net/prata/ (i found doesn't work in firefox)

the difference while someid works in browsers, document.getelementbyid("someid") complies w3c standard.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -