SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict kunalraj's Avatar
    Join Date
    Nov 2008
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can i scroll two frame at once in IE 6.0?

    Hello frns.

    I have script which is scroll two frame at once but it is only work in mozilla.

    i am using Internet Explorer 6.0, so my code is not working in it also i have tested it into IE 7.0.

    my cod is :
    1.) fscroll_left.jsp


    <html>
    <head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <title>Frame</title>
    <script TYPE="text/JavaScript">
    var _run;

    if (navigator.appName == "Microsoft Internet Explorer")
    {_run=false;}
    else {_run= true;}

    function vScroll() // begin function
    {
    var top = (window.pageYOffset)?(window.pageYOffset)document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
    parent.frames["right"].scrollTo(0,top);
    }

    function searchScroll(){ // begin function
    var top = (window.pageYOffset)?(window.pageYOffset)document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
    parent.frames["right"].scrollTo(0,top);
    window.setTimeout("searchScroll();",1);
    }

    if(_run == false) // if the browser is Mozilla FireBird or if it’s Internet Explorer…
    {
    window.onscroll =function(){vScroll();} // when the document is scrolled, run the function specified.
    } else { // If the browser is not Mozilla FireBird or Internet Explorer…
    window.onload=function(){searchScroll()} // when the document loads, run the function specified. Remember we’re using a setTimeout function with this function, because it takes place when the document loads, not when it is scrolled (some browsers do not support the window.onscroll event handler).
    }
    </script>
    </head>
    <BODY>
    <div style="height: 800%;"><P>This is a paragraph of text, so we don’t have a blank page!</P></div>
    </BODY></html>

    2). fscroll_right.jsp


    <html>
    <head><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <title>Frame</title>
    <script TYPE="text/JavaScript">
    var _run;


    if (navigator.appName == "Microsoft Internet Explorer")
    {_run=false;}
    else {_run= true;}

    function vScroll() // begin function
    {
    var top = (window.pageYOffset)?(window.pageYOffset)document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
    parent.frames["left"].scrollTo(0,top);
    }

    function searchScroll(){ // begin function
    var top = (window.pageYOffset)?(window.pageYOffset)document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
    parent.frames["left"].scrollTo(0,top);
    window.setTimeout("searchScroll();",1);
    }

    if(_run == false) // if the browser is Mozilla FireBird or if it’s Internet Explorer…
    {
    window.onscroll=function(){vScroll();} // when the document is scrolled, run the function specified.
    } else { // If the browser is not Mozilla FireBird or Internet Explorer…
    window.onload=function(){searchScroll()} // when the document loads, run the function specified. Remember we’re using a setTimeout function with this function, because it takes place when the document loads, not when it is scrolled (some browsers do not support the window.onscroll event handler).
    }
    </script>
    </head>
    <BODY>
    <div STYLE="height: 800%;"><P>This is a paragraph of text, so we don’t have a blank page!</P></div>
    </BODY>
    </html>

    3). fscroll_main.jsp

    <html>
    <head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <title>Vertical Synchronization with Frames</title>
    <SCRIPT type="text/JavaScript">
    var sys = "document.body.scrollTop";
    </SCRIPT>

    <FRAMESET id="fscroll" name="fscroll" rows="150,*">
    <FRAME src="fscroll_left.html" name="left" id="left">
    <FRAME src="fscroll_right.html" name="right" id="right">
    </FRAMESET>
    </head>
    <BODY>
    <P>Your browser does not support frames. Please download the latest version of your current browser, or get a new one, to view this site.</P>
    </BODY>
    </html>



    If any one have idea how can i scroll two frame at once in IE 6.0 then please let me know.

  2. #2
    SitePoint Wizard rozner's Avatar
    Join Date
    Oct 2002
    Location
    Paris
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a Javascript problem, not Java.

    Anyway I think your problem is

    window.pageYOffset

    In IE it's something like document.offsetHeight, not 100&#37; sure on that, but I know there are differences between the way IE and every other browser handles these things.

  3. #3
    SitePoint Addict kunalraj's Avatar
    Join Date
    Nov 2008
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for reply.

    yes i know its problem of javascript. and you are right window.pageYOffset is not support IE.

    But problem is i have also written this (document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop; is for IE 6.0 & lesser still it is not working why it is happen.


    whenever you know something about it please inform me.

    thanks.
    Last edited by kunalraj; Dec 4, 2008 at 23:48.

  4. #4
    SitePoint Wizard rozner's Avatar
    Join Date
    Oct 2002
    Location
    Paris
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i know its problem of javascript
    My point was that you'd have a better chance getting an answer in the Javascript forum. I'll see if I can get a mod to move this.

  5. #5
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kunalraj View Post
    scroll two frames at once
    http://scripterlative.com?mutual
    Tab-indentation is a crime against humanity.

  6. #6
    SitePoint Addict kunalraj's Avatar
    Join Date
    Nov 2008
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey friends,

    I got solution.

    <script TYPE="text/JavaScript">

    function vScroll()
    {

    var position = (document.documentElement.scrollTop);
    window.parent.frames[0].scrollTo(0,position);

    var position = (document.body.scrollTop);
    window.parent.frames[0].scrollTo(0,position);

    }

    window.onscroll=function(){
    vScroll();
    }

    </script>

    It is only for IE not for other browser.

    it can be add in this script as a function.


    thanks for replying.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •