Hi
I’ve found a script that makes a div scroll across and down the page as the page is scrolled. I’ve got it to work but I do not fully understand how it works which will not help me in future so could some one help please!?
For the most part I do understand what it does but there are a few lines of code I’m not sure of.
1. var yPos = (document.all ) ? document.body.scrollTop : window.pageYOffset;
I understand this initialises a variable but what I don’t understand is what the document.all does (something to do with IE4 but other than that I’m baffled) and basically I don’t see what any of the rest of the line does/means.
2. var divStyle = (document.getElementById) ? document.getElementById(divID).style : ( (document.all) ? document.all[divID].style : document.layers[divID] );
Again is a variable and divID is the name of the element on the page that is to scroll, but I’m not sure of the rest of the line?
If someone could explain this to me I’d be grateful as I hate not understanding how stuff works, specifically what the question marks and colons are used for in these lines?!
Many thanks for any help you can give me