SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Doctype, FireFox & the menu that (does not) scroll,

    Hi guys

    I've the following piece of code
    PHP Code:
    <div id="point1" STYLE="position:absolute;visibility:visible;">    
                    <
    table width="100" border="0" bordercolor="#BBBBBB" cellspacing="0" cellpadding="4">
                        <
    tr>
                            <
    td align=center>
                                <
    script webstyle3 src="http://www.mysite.com/tabs_jr1.js"></script>
                            </td>
                        </tr>
                    </table>
                </div>
    <script LANGUAGE="JavaScript1.2">
    var XX=31; // X position of the scrolling objects
    var xstep=0;
    var delay_time=122;
    var YY=0;  
    var ch=0;
    var oh=0;
    var yon=0;

    var ns4=document.layers?1:0
    var ie=document.all?1:0
    var ns6=document.getElementById&&!document.all?1:0

    if(ie){
        if (document.documentElement && document.documentElement.clientHeight) {
        YY=document.documentElement.clientHeight;
        } else if (document.body) {
        YY=document.body.clientHeight;
        }
    point1.style.top=YY;
    }
    else if (ns4){
    YY=window.innerHeight;
    document.point1.pageY=YY;
    document.point1.visibility="hidden";
    }
    else if (ns6){
    YY=window.innerHeight
    document.getElementById('point1').style.top=YY
    }


    function reloc1()
    {

    if(yon==0){YY=YY-xstep;}
    else{YY=YY+xstep;}
    if (ie){
        if (document.documentElement && document.documentElement.clientHeight) {
        ch=document.documentElement.clientHeight;
        } else if (document.body) {
        ch=document.body.clientHeight;
        }oh=point1.offsetHeight;
    }
    else if (ns4){
    ch=window.innerHeight;
    oh=document.point1.clip.height;
    }
    else if (ns6){
    ch=window.innerHeight
    oh=document.getElementById("point1").offsetHeight
    }
            
    if(YY<0){yon=1;YY=0;}
    if(YY>=(ch-oh)){yon=0;YY=(ch-oh);}
    if(ie){
    point1.style.left=XX;
        if (document.documentElement && document.documentElement.scrollTop) {
        point1.style.top=YY+document.documentElement.scrollTop;
        } else if (document.body) {
        point1.style.top=YY+document.body.scrollTop;
        }
    }
    else if (ns4){
    document.point1.pageX=XX;
    document.point1.pageY=YY+window.pageYOffset;
    }
    else if (ns6){
    document.getElementById("point1").style.left=XX
    document.getElementById("point1").style.top=YY+window.pageYOffset
    }

    }

    function onad()
    {
    if(ns4)
    document.point1.visibility="visible";
    loopfunc();
    }
    function loopfunc()
    {
    reloc1();
    setTimeout('loopfunc()',delay_time);
    }

    if (ie||ns4||ns6)
    window.onload=onad
    </script> 
    As you can see, I'm calling an externel file @ http://www.mysite.com/tabs_jr1.js. Well, the externel one is not a problem. Here is what is happenning wrong.

    I'm executing the above code in some pages, some with a doctype
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
    and some with
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    Now in case of the later, I have no problem anywhere, it is working fine both in IE and FF. However, in case of the previous doctype, though working well in IE, not working in the FF, and the menu is sticked somewhere in the page.

    Any idea guys ? I guess, for some reason, it is unable to read stuffs like clientHeight and scrollTop in FF !!!
    Last edited by kigoobe; Dec 15, 2005 at 00:26.

  2. #2
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no one, guys ?

  3. #3
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well got some hints thro' devshed. I need to put +'px' with my X and Y cordinates. The script is done by somebody else, and for the moment I could only found the x cordinate. I have put +'px' with that, and it is working now for the x cordinate. I need to find the y cordinate now, and then it should be working ...

    For the moment I'm unable to find it though I'm still trying, not being very good in JavaScript. So if any one of u guys can make it, thanks for helping.

  4. #4
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hah! Done, atlast ...


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
  •