I really cannot understand why this does not work. I\'ve tried couple of tricks but I just don\'t get it.
You need to call this script in onload event i.e
window.onload=function(){ //your code }