Advertisement

04.28.2008 at 10:04AM PDT, ID: 23359372
[x]
Attachment Details

JS, HTML document scrolling for IE 6&7

Asked by willsherwood in JScript, Dynamic HTML (DHTML)

I'm using a script that an EE gave me and it works fine in FF, but i just tried it in IE and it doesn't scroll to the top.
The desired behavior is to have the top of the picture in the div to be at the top of the browser window.

Below is the JS code, and then the   <div> in question

<script type='text/javascript'>
            function findTopPos(obj)
            {
              var curtop = 0;
              if (obj.offsetParent) {
                  do {
                    curtop += obj.offsetTop;
                  } while (obj = obj.offsetParent);
              }
              return curtop;
            }

            document.body.scrollTop = document.documentElement.scrollTop = findTopPos(document.getElementById('flashcontent'));
            </script>


<div id='flashcontent'><img src='image/image-loading.gif'>   etc.
</div>



any advice on how i can get this to work in IE 6 & 7 ?   (FF, Opera, Safari for windows all work fine)

Start Free Trial
 
 
[+][-]04.28.2008 at 12:30PM PDT, ID: 21456902

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JScript, Dynamic HTML (DHTML)
Sign Up Now!
Solution Provided By: Kravimir
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.28.2008 at 01:16PM PDT, ID: 21457250

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628