Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrollTop & document/documentElement 2

Status
Not open for further replies.

papageno

Technical User
Dec 25, 2004
24
0
0
ES
In WXP IE6, I have a button call foo():

Code:
var frame = window.frames['fname'];
frame.window.scroll(0,300);

function foo () {
   if (frame.window.innerHeight) {
      pos = frame.window.pageYOffset
      alert('window '+pos)
   } else if (frame.document.documentElement
   && frame.document.documentElement.scrollTop) {
      pos = frame.document.documentElement.scrollTop
      alert('documentElement '+pos)
   } else if (frame.document.body) {
      pos = frame.document.body.scrollTop
      alert('document '+pos)
   }
   frame.window.scroll(0,pos);
}

Now the first time I push the button, the result is "document 0", next time(s) the result is the expected "documentElement 0".

So ... ? Am I dumb (probably) or what? =(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top