View Full Version : pageYoffset undefined in child

04-11-2003, 02:38 AM
i have opened a child window and am trying to display the
pageYOffset like this

child.document.write('the offset is '+child.pageYOffset);

i keep getting undefined
as the result...

any idea why???
:confused: ez

04-11-2003, 05:44 AM
never heard of child.

04-11-2003, 08:05 AM
apologies if that wasnt too clear :(
oh well what i mean is child where child is any child window
in this case i open a window from the main page called search, so im saying that this is a child window

here are the attribs of search
var pop_search="width=400,height=480,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,directories=no,location=no, menubar=no,status=no";
var search = window.open('','search_window',pop_search);

so then i do

search.document.write('the offset is '+search.pageYOffset);

in other words im trying to display the pageYoffset in the child window named search and i keep getting undefined no matter how much stuff is on the page

i have also tried
search.document.write ("<script>document.write(pageYOffset)<\/script>");
still undefined...

any ideas?


04-11-2003, 08:50 AM
pageYOffset is NS-only, isn't it?

You need document.body.scrollTop for IE (unless you've got IE6 and an XHTML doctype, in which case you'd want document.documentElement.scrollTop)

04-14-2003, 01:19 AM
Wow! :eek: my 1400 page Pure Javascript manual says IE 4+ Nav4+

I hate it when that happens!:mad:

Thanks Beetle.....
ez :D