To get the scroll bar ordinate position of the current page:
document.documentElement.sctrollTop;
Instead of:
document.body.scrollTop;
documentElement corresponds html tags, the tag body corresponds to the body
In w3c standard, document.body.scrollTop constant at 0, instead of the need document.documentElement.scrollTop
window.scroll = function(){
if(document.documentElement.scrollTop+document.body.scrollTop >50){
document.getElementById('#test').style.display ="block";
}else{
document.getElementById("#test").style.display = "none";
}
}