471,872 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,872 software developers and data experts.

Scroll 2 windows at once in IE7

Hi Guys,

I'm writing a little webbased application for my bosses at work which utilises PHP, Javascript and HTML.
I have very little knowledge of javascript itself but I found a script that allowed 2 seperate frames on 1 page to be scrolled at the same time, which I needed as I am showing table row headers in 1 small side column and the rest of the table in the main window but as its taller than the page they need to scroll at the same time.

On me loading my frameset the script works fine and both windows scroll together exactly how I would like, I then tell it to load my table into the main frame window and then load the row headers in to the side column and it no longer scrolls together which is an issue to say the least. I have included the code on the page I am opening and in Firefox and Konqueror the script works as I would like when I click on the link.

The script is as follows:
Expand|Select|Wrap|Line Numbers
  1. var _run;
  2. if(navigator.userAgent.indexOf("Firebird")!=-1||navigator.appName=="Microsoft Internet Explorer")
  3. {_run=false;}
  4. else {_run= true;}
  6. function vScroll()
  7. {
  8. var top = (window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop; 
  10. parent.frames["right"].scrollTo(0,top);
  12. }
  14. function searchScroll(){
  15. var top = (window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
  17. parent.frames["right"].scrollTo(0,top);
  19. window.setTimeout("searchScroll();",1);
  21. }
  22. if(_run == false)
  23. {
  24. window.onscroll=function(){vScroll();} 
  25. } else { 
  26. window.onload=function(){searchScroll()}
  27. }
You put this at the top of the page you would like to be in control of the scrolling the the rest works like magic, just not when you start reopening pages in IE.

If there a way around this or a better solution??


May 11 '07 #1
1 2296
1,208 Expert 1GB
what do you mean by reopening? refreshing the page?
May 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.